Removed last use of /proc

In the last several commits, all uses of the /proc virtual file system
have been removed, intentionally in some places, unintentionally in
others. Now I've finished that job, hopefully this will make it easier
to port the program on systems which don't support procfs by default,
such as FreeBSD and OpenBSD.
This commit is contained in:
Petar Kapris 2021-01-02 21:00:35 +01:00
parent 5469d5ec00
commit 097a93441b

View file

@ -823,8 +823,7 @@ void check_idle()
struct stat status; struct stat status;
time_t idle, sesstime; time_t idle, sesstime;
sprintf(path, "/proc/%d", utmpp->ut_pid); 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 || stat(path, &status)) /* 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 */