From 007c2d3ccf7cd5590ff6551213b4aff079d1ea95 Mon Sep 17 00:00:00 2001 From: Petar Kapris Date: Sun, 3 Jan 2021 17:04:39 +0100 Subject: [PATCH] Rewrite process existence check for readability --- timeoutd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timeoutd.c b/timeoutd.c index 2af48f7..6ec4218 100644 --- a/timeoutd.c +++ b/timeoutd.c @@ -823,7 +823,7 @@ void check_idle() struct stat status; time_t idle, sesstime; - if (utmpp->ut_type != USER_PROCESS || kill(utmpp->ut_pid, 0)) /* if not user process, or if proc doesn't exist */ + if (utmpp->ut_type != USER_PROCESS || kill(utmpp->ut_pid, 0) == -1) /* if not user process, or if proc doesn't exist */ return; /* skip the utmp entry */ strncpy(user, utmpp->ut_user, sizeof(user) - 1); /* get user name */ user[sizeof(user) - 1] = '\0'; /* null terminate user name string */