]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: 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 15:01:55 +0000 (16:01 +0100)
term-utils/script.c: In function 'log_close.part.0.isra':
term-utils/script.c:306:3: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/script.c:303:18: note: 'now.tv_usec' was declared here
term-utils/script.c:306:3: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/script.c:303:18: note: 'now.tv_sec' was declared here

Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/script.c

index eca63f7f49659ed27db33fda551d7d03a7437ecb..bb2dbdee6c3f542a208f946a0ba96b45482c2391 100644 (file)
@@ -300,7 +300,7 @@ static int log_close(struct script_control *ctl,
        }
        case SCRIPT_FMT_TIMING_MULTI:
        {
-               struct timeval now, delta;
+               struct timeval now = { 0 }, delta = { 0 };
 
                gettime_monotonic(&now);
                timersub(&now, &log->starttime, &delta);