Fix utmp entry check in check_idle()
This commit is contained in:
parent
d8f6dd3b5e
commit
c272cf17db
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue