From ff62f4d4257c762d821f46f2d1caa8947be34b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 6 Jun 2022 08:43:52 +0000 Subject: [PATCH] mon_tools: fix user counting condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ut_user (aka ut_name) member of struct utmp is a statically allocated string, thus always non-NULL. GitHub-ID: https://github.com/ibm-s390-linux/s390-tools/pull/137 Signed-off-by: Dan Horák Acked-by: Gerald Schaefer Signed-off-by: Jan Höppner --- mon_tools/mon_procd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mon_tools/mon_procd.c b/mon_tools/mon_procd.c index 5bf741e4..aabc33ff 100644 --- a/mon_tools/mon_procd.c +++ b/mon_tools/mon_procd.c @@ -248,7 +248,7 @@ static void count_users(void) proc_sum.users = 0; setutent(); while ((temp = getutent())) { - if ((temp->ut_type == USER_PROCESS) && (temp->ut_name)) + if (temp->ut_type == USER_PROCESS) proc_sum.users++; } endutent();