]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
scriptreplay: fix io data log use
authorKarel Zak <kzak@redhat.com>
Wed, 2 Oct 2019 14:13:25 +0000 (16:13 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 8 Oct 2019 11:11:54 +0000 (13:11 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/script-playutils.c

index c620946da5ee2212fd607f9a2527dc72d58293a6..b08a4e25b86fc704c8d3a1b49b940408069e61d2 100644 (file)
@@ -40,7 +40,7 @@ struct replay_log {
        const char      *filename;
        FILE            *fp;
 
-       unsigned int    noseek;         /* do not seek in this log */
+       unsigned int    noseek : 1;     /* do not seek in this log */
 };
 
 struct replay_step {
@@ -169,6 +169,7 @@ static struct replay_log *replay_new_log(struct replay_setup *stp,
        log = &stp->logs[stp->nlogs];
        stp->nlogs++;
 
+       memset(log, 0, sizeof(*log));
        log->filename = filename;
        log->streams = streams;
        log->fp = f;
@@ -371,7 +372,6 @@ static int replay_seek_log(struct replay_log *log, size_t move)
 {
        if (log->noseek)
                return 0;
-
        DBG(LOG, ul_debug(" %s: seek ++ %zu", log->filename, move));
        return fseek(log->fp, move, SEEK_CUR) == (off_t) -1 ? -errno : 0;
 }