]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lslogins: fix assertion failure for none existing logins
authorSami Kerola <kerolasa@iki.fi>
Mon, 8 Dec 2014 22:20:55 +0000 (22:20 +0000)
committerKarel Zak <kzak@redhat.com>
Tue, 9 Dec 2014 08:19:39 +0000 (09:19 +0100)
This cange makes the following to retun none-zero value instead of a core
dump.

$ lslogins qwertyuiopasdfghjklzxcvbnm1234567
lslogins: libsmartcols/src/line.c:362: scols_line_get_cell: Assertion `ln' failed.
Aborted (core dumped)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/lslogins.c

index 7867404c9d31e50390c3a9046fb5882088cb9365..38d3cf681ac4b520e2c718bf46905ed69040f6e9 100644 (file)
@@ -842,7 +842,7 @@ static int get_user(struct lslogins_control *ctl, struct lslogins_user **user,
                    const char *username)
 {
        *user = get_user_info(ctl, username);
-       if (!*user && errno)
+       if (!*user)
                if (IS_REAL_ERRNO(errno))
                        return -1;
        return 0;