mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:55:07 -05:00
rtc+getdate: initialize tm_wday for mktime()
Even though mktime() is documented as ignoring the tm_wday field, the coverity static analyzer complains about passing an uninitialized value. Set the field to zero to make it happy.
This commit is contained in:
@@ -943,6 +943,7 @@ get_date (const char *p, const time_t *now)
|
|||||||
tm.tm_hour += yyRelHour;
|
tm.tm_hour += yyRelHour;
|
||||||
tm.tm_min += yyRelMinutes;
|
tm.tm_min += yyRelMinutes;
|
||||||
tm.tm_sec += yyRelSeconds;
|
tm.tm_sec += yyRelSeconds;
|
||||||
|
tm.tm_wday = 0;
|
||||||
|
|
||||||
/* Let mktime deduce tm_isdst if we have an absolute timestamp,
|
/* Let mktime deduce tm_isdst if we have an absolute timestamp,
|
||||||
or if the relative timestamp mentions days, months, or years. */
|
or if the relative timestamp mentions days, months, or years. */
|
||||||
|
|||||||
@@ -802,6 +802,7 @@ read_from_device(int fd_, int event, void *any)
|
|||||||
rtc_tm.tm_mday = rtc_raw.tm_mday;
|
rtc_tm.tm_mday = rtc_raw.tm_mday;
|
||||||
rtc_tm.tm_mon = rtc_raw.tm_mon;
|
rtc_tm.tm_mon = rtc_raw.tm_mon;
|
||||||
rtc_tm.tm_year = rtc_raw.tm_year;
|
rtc_tm.tm_year = rtc_raw.tm_year;
|
||||||
|
rtc_tm.tm_wday = 0;
|
||||||
|
|
||||||
rtc_t = t_from_rtc(&rtc_tm);
|
rtc_t = t_from_rtc(&rtc_tm);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user