From c272cf17db84b70515b14e6d8020fac59592dca8 Mon Sep 17 00:00:00 2001 From: Petar Kapris Date: Thu, 17 Dec 2020 22:01:08 +0100 Subject: [PATCH] Fix utmp entry check in check_idle() --- timeoutd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/timeoutd.c b/timeoutd.c index d168e7d..c684da5 100644 --- a/timeoutd.c +++ b/timeoutd.c @@ -858,8 +858,7 @@ void check_idle() pstat = &status; /* point to status structure */ sprintf(path, "/proc/%d", utmpp->ut_pid); - if (utmpp->ut_type != USER_PROCESS || !utmpp->ut_user[0] || /* if not user process */ - stat(path, pstat)) /* or if proc doesn't exist */ + if (utmpp->ut_type != USER_PROCESS || stat(path, pstat)) /* 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 */