If <x> 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).
This commit is contained in:
gad 2004-03-28 03:00:56 +00:00
parent c148ed96ea
commit 72d6e1aaae

View File

@ -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) {