Mercurial > hg > octave-lojdl > gnulib-hg
changeset 7520:ff9fa1a14d98
(desirable_utmp_entry): Implement new flag: READ_UTMP_USER_PROCESS.
author | Sergey Poznyakoff <gray@gnu.org.ua> |
---|---|
date | Wed, 18 Oct 2006 13:24:19 +0000 |
parents | e8059bfe7afd |
children | 2e592d70280a |
files | lib/readutmp.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/readutmp.c +++ b/lib/readutmp.c @@ -69,10 +69,15 @@ 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-