From 5dfd7724a302ffc2c2c001a7a26628433b2732ec Mon Sep 17 00:00:00 2001 From: Garance A Drosehn Date: Sun, 28 Mar 2004 03:00:56 +0000 Subject: [PATCH] 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(-) diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 2488ef6f033..466a8e96620 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) {