diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-02-04 12:58:28 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-02-04 12:58:28 +0000 |
commit | cb593e204ae8c1b9e69a0b292bce8eb553d04148 (patch) | |
tree | e835bc870637c8ffbef3b039cb81283ee68b2e6f /bin/ps/ps.c | |
parent | a7d900a0f398f5ffe1a73291c0bd129723ecc206 (diff) |
(uid_t) -1 is a valid uid, so do not use it as a flag.
From Joris Vink <nimadeus at pandora dot be> with tweaks from me.
ok tdeval@ hshoexer@ henning@
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r-- | bin/ps/ps.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 385d990e357..6d00f87b309 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ps.c,v 1.35 2004/01/08 18:18:35 millert Exp $ */ +/* $OpenBSD: ps.c,v 1.36 2004/02/04 12:58:27 otto Exp $ */ /* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */ /*- @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: ps.c,v 1.35 2004/01/08 18:18:35 millert Exp $"; +static char rcsid[] = "$OpenBSD: ps.c,v 1.36 2004/02/04 12:58:27 otto Exp $"; #endif #endif /* not lint */ @@ -111,7 +111,7 @@ main(int argc, char *argv[]) pid_t pid; uid_t uid; int all, ch, flag, i, fmt, lineno, nentries, mib[6]; - int prtheader, wflag, kflag, what, xflg; + int prtheader, wflag, kflag, what, Uflag, xflg; char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX]; size_t size; @@ -126,9 +126,9 @@ main(int argc, char *argv[]) if (argc > 1) argv[1] = kludge_oldps_options(argv[1]); - all = fmt = prtheader = wflag = kflag = xflg = 0; + all = fmt = prtheader = wflag = kflag = Uflag = xflg = 0; pid = -1; - uid = (uid_t) -1; + uid = 0; ttydev = NODEV; memf = nlistf = swapf = NULL; while ((ch = getopt(argc, argv, @@ -225,7 +225,7 @@ main(int argc, char *argv[]) errx(1, "%s: no such user", optarg); uid = pwd->pw_uid; endpwent(); - xflg = 1; + Uflag = xflg = 1; break; case 'u': parsefmt(ufmt); @@ -283,7 +283,7 @@ main(int argc, char *argv[]) parsefmt(dfmt); /* XXX - should be cleaner */ - if (!all && ttydev == NODEV && pid == -1 && uid == (uid_t)-1) + if (!all && ttydev == NODEV && pid == -1 && !Uflag) uid = getuid(); /* @@ -294,7 +294,7 @@ main(int argc, char *argv[]) /* * get proc list */ - if (uid != (uid_t) -1) { + if (Uflag) { what = KERN_PROC_UID; flag = uid; } else if (ttydev != NODEV) { |