update from texinfo
[gnulib.git] / lib / readutmp.c
index 846ab3c..73c7b53 100644 (file)
@@ -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-