]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: check fstat() return [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 1 Oct 2013 14:59:43 +0000 (16:59 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 1 Oct 2013 14:59:43 +0000 (16:59 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/last.c

index 6bec57d172f9603dc45d2b6fac27b5abee409e1c..8da42bafbf3c8829ba98930bc4ce102c7c619093 100644 (file)
@@ -623,7 +623,8 @@ static void process_wtmp_file(const struct last_control *ctl)
        if (uread(ctl, fp, &ut, NULL) == 1)
                begintime = ut.UL_UT_TIME;
        else {
-               fstat(fileno(fp), &st);
+               if (fstat(fileno(fp), &st) != 0)
+                       err(EXIT_FAILURE, _("stat failed %s"), ctl->altv[ctl->alti]);
                begintime = st.st_ctime;
                quit = 1;
        }