]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: fix compiler warnings [-Wmaybe-uninitialized]
authorKarel Zak <kzak@redhat.com>
Mon, 14 Dec 2020 14:56:55 +0000 (15:56 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 14 Dec 2020 14:59:45 +0000 (15:59 +0100)
sys-utils/hwclock-rtc.c: In function 'synchronize_to_clock_tick_rtc':
sys-utils/hwclock.c:169:28: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/hwclock-rtc.c:215:24: note: 'now.tv_usec' was declared here
sys-utils/hwclock.c:168:28: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/hwclock-rtc.c:215:24: note: 'now.tv_sec' was declared here
sys-utils/hwclock.c:169:28: warning: 'begin.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/hwclock-rtc.c:215:17: note: 'begin.tv_usec' was declared here
sys-utils/hwclock.c:168:28: warning: 'begin.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
sys-utils/hwclock-rtc.c:215:17: note: 'begin.tv_sec' was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/hwclock-rtc.c

index fb94868481ebca1920712b02993f32fc59270efd..163f04e7a5e83d10c6fff2f6886ede2d648a3f16 100644 (file)
@@ -212,7 +212,7 @@ static int busywait_for_rtc_clock_tick(const struct hwclock_control *ctl,
        /* The time when we were called (and started waiting) */
        struct tm nowtime;
        int rc;
-       struct timeval begin, now;
+       struct timeval begin = { 0 }, now = { 0 };
 
        if (ctl->verbose) {
                printf("ioctl(%d, RTC_UIE_ON, 0): %s\n",