From: Sergey Poznyakoff Date: Wed, 18 Oct 2006 13:24:19 +0000 (+0000) Subject: (desirable_utmp_entry): Implement new flag: READ_UTMP_USER_PROCESS. X-Git-Tag: cvs-readonly~1698 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=5db0c7e10ac53ae2a00e67cd345c2bcd6583ed1d;p=gnulib.git (desirable_utmp_entry): Implement new flag: READ_UTMP_USER_PROCESS. --- diff --git a/lib/readutmp.c b/lib/readutmp.c index cf29572f0..aec1fee44 100644 --- a/lib/readutmp.c +++ b/lib/readutmp.c @@ -69,10 +69,15 @@ extract_trimmed_name (const STRUCT_UTMP *ut) static inline bool desirable_utmp_entry (STRUCT_UTMP const *u, int options) { - return ! (options & READ_UTMP_CHECK_PIDS - && IS_USER_PROCESS (u) - && (UT_PID (u) <= 0 - || (kill (UT_PID (u), 0) < 0 && errno == ESRCH))); + int up = IS_USER_PROCESS (u); + if ((options & READ_UTMP_USER_PROCESS) && !up) + return false; + if ((options & READ_UTMP_CHECK_PIDS) + && up + && (UT_PID (u) <= 0 + || (kill (UT_PID (u), 0) < 0 && errno == ESRCH))) + return false; + return true; } /* Read the utmp entries corresponding to file FILE into freshly-