[hackers] [ubase] Only check errno if getpwuid() fails || Hiltjo Posthuma
commit e45e64491ea092fd40e358ce7a81c2736d747f02
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Wed Jul 9 15:42:54 2014 +0000
Only check errno if getpwuid() fails
Checking errno otherwise is unspecified.
diff --git a/ps.c b/ps.c
index f45fb99..9bb8f2e 100644
--- a/ps.c
+++ b/ps.c
_AT_@ -136,8 +136,12 @@ psout(struct procstat *ps)
} else {
errno = 0;
pw = getpwuid(pstatus.uid);
- if (errno || !pw)
- eprintf("getpwuid %d:", pstatus.uid);
+ if (!pw) {
+ if (errno)
+ eprintf("getpwuid %d:", pstatus.uid);
+ else
+ eprintf("getpwuid %d: no such user
", id);
+ }
if (sysinfo(&info) < 0)
eprintf("sysinfo:");
Received on Wed Jul 09 2014 - 16:08:15 CEST
This archive was generated by hypermail 2.3.0
: Wed Jul 09 2014 - 16:12:10 CEST