ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit e45e64491ea092fd40e358ce7a81c2736d747f02
parent 291aedb87546fb565962a08aa94fbfc94ccd83f3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed,  9 Jul 2014 15:42:54 +0000

Only check errno if getpwuid() fails

Checking errno otherwise is unspecified.

Diffstat:
Mps.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ps.c b/ps.c @@ -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\n", id); + } if (sysinfo(&info) < 0) eprintf("sysinfo:");