summaryrefslogtreecommitdiffstats
path: root/login-utils/lslogins.c
diff options
context:
space:
mode:
authorKarel Zak2017-08-18 10:23:38 +0200
committerKarel Zak2017-08-18 10:23:38 +0200
commitf4513f27c2e2c8919bffcd7a356e364b0647eb29 (patch)
treeea9a56d803c33375c72c7e9ffa5eb09bc0a3246b /login-utils/lslogins.c
parentmisc: fix some printf format strings (diff)
downloadkernel-qcow2-util-linux-f4513f27c2e2c8919bffcd7a356e364b0647eb29.tar.gz
kernel-qcow2-util-linux-f4513f27c2e2c8919bffcd7a356e364b0647eb29.tar.xz
kernel-qcow2-util-linux-f4513f27c2e2c8919bffcd7a356e364b0647eb29.zip
lslogins: ignore non-existing users
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/lslogins.c')
-rw-r--r--login-utils/lslogins.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index 186ec6cbd..5d896d73c 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -895,12 +895,11 @@ static int create_usertree(struct lslogins_control *ctl)
size_t n = 0;
if (ctl->ulist_on) {
- while (n < ctl->ulsiz) {
+ for (n = 0; n < ctl->ulsiz; n++) {
if (get_user(ctl, &user, ctl->ulist[n]))
- return -1;
+ continue;
if (user) /* otherwise an invalid user name has probably been given */
tsearch(user, &ctl->usertree, cmp_uid);
- ++n;
}
} else {
while ((user = get_next_user(ctl)))