]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lslogins: call close() for usable FD [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 25 Nov 2020 13:02:11 +0000 (14:02 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 25 Nov 2020 13:02:11 +0000 (14:02 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/lslogins.c

index 8a6ef713fa482f7d014e1dd98ca0f1e69bbd0334..773d13a953a3310bd12a1a017757b8b09261b9f7 100644 (file)
@@ -1654,7 +1654,9 @@ int main(int argc, char *argv[])
 
        scols_unref_table(tb);
        tdestroy(ctl->usertree, free_user);
-       close(ctl->lastlogin_fd);
+
+       if (ctl->lastlogin_fd >= 0)
+               close(ctl->lastlogin_fd);
        free_ctl(ctl);
 
        return EXIT_SUCCESS;