Rewrite process existence check for readability
This commit is contained in:
parent
097a93441b
commit
007c2d3ccf
|
@ -823,7 +823,7 @@ void check_idle()
|
||||||
struct stat status;
|
struct stat status;
|
||||||
time_t idle, sesstime;
|
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 */
|
return; /* skip the utmp entry */
|
||||||
strncpy(user, utmpp->ut_user, sizeof(user) - 1); /* get user name */
|
strncpy(user, utmpp->ut_user, sizeof(user) - 1); /* get user name */
|
||||||
user[sizeof(user) - 1] = '\0'; /* null terminate user name string */
|
user[sizeof(user) - 1] = '\0'; /* null terminate user name string */
|
||||||
|
|
Loading…
Reference in a new issue