we're not checking the return value of sscanf(), which says how many of
the expected values it successfully parsed. given an invalid
rgw_lifecycle_work_time string, any unparsed values would remain
uninitialized - so preinitialize them with reasonable defaults
Signed-off-by: Casey Bodley <cbodley@redhat.com>
bool RGWLC::LCWorker::should_work(utime_t& now)
{
- int start_hour;
- int start_minute;
- int end_hour;
- int end_minute;
+ int start_hour = 0;
+ int start_minute = 0;
+ int end_hour = 23;
+ int end_minute = 59;
string worktime = cct->_conf->rgw_lifecycle_work_time;
sscanf(worktime.c_str(),"%d:%d-%d:%d",&start_hour, &start_minute,
&end_hour, &end_minute);
return (secs);
}
- int start_hour;
- int start_minute;
- int end_hour;
- int end_minute;
+ int start_hour = 0;
+ int start_minute = 0;
+ int end_hour = 23;
+ int end_minute = 59;
string worktime = cct->_conf->rgw_lifecycle_work_time;
sscanf(worktime.c_str(),"%d:%d-%d:%d",&start_hour, &start_minute, &end_hour,
&end_minute);