X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Freadutmp.c;h=73c7b53084b7311870aeb558a76a9ece85a0b3dc;hb=8badccbd46d6cbd0f1fa2014e01ce8a7cae2b272;hp=cf29572f093ee28629c268cd15e0ad399dd239cf;hpb=0632e115747ff96e93330c88f536d7354a7ce507;p=gnulib.git diff --git a/lib/readutmp.c b/lib/readutmp.c index cf29572f0..73c7b5308 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))); + bool user_proc = IS_USER_PROCESS (u); + if ((options & READ_UTMP_USER_PROCESS) && !user_proc) + return false; + if ((options & READ_UTMP_CHECK_PIDS) + && user_proc + && (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-