From 72d6e1aaae1fda541fcea91acd357044751527bb Mon Sep 17 00:00:00 2001 From: gad Date: Sun, 28 Mar 2004 03:00:56 +0000 Subject: If is a process id that does not exist, then just print the header (if any) and exit, thus matching the behavior on -stable and other OS's. My earlier attempt to fix this (v1.65) only seemed to work because of a lucky random value in nentries (which was not being initialized back when I tested that earlier patch). --- bin/ps/ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 2488ef6..466a8e9 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -497,7 +497,7 @@ main(int argc, char *argv[]) */ nentries = -1; kp = kvm_getprocs(kd, what, flag, &nentries); - if ((kp == 0 && nentries != 0) || nentries < 0) + if ((kp == 0 && nentries > 0) || (kp != 0 && nentries < 0)) errx(1, "%s", kvm_geterr(kd)); nkept = 0; if (nentries > 0) { -- cgit v1.1