X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Freadutmp.c;h=73c7b53084b7311870aeb558a76a9ece85a0b3dc;hb=f27d815b351a4f960aad64b96b5331bcbf8799a0;hp=846ab3c6a2da7103752ec757a18172697f880384;hpb=917390a696fb41df64df466fb5a4cf8ab00522da;p=gnulib.git diff --git a/lib/readutmp.c b/lib/readutmp.c index 846ab3c6a..73c7b5308 100644 --- a/lib/readutmp.c +++ b/lib/readutmp.c @@ -1,5 +1,7 @@ /* GNU's read utmp module. - Copyright (C) 1992-2001, 2003, 2004, 2005 Free Software Foundation, Inc. + + Copyright (C) 1992-2001, 2003, 2004, 2005, 2006 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,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-