diff options
author | gad <gad@FreeBSD.org> | 2004-03-28 03:00:56 +0000 |
---|---|---|
committer | gad <gad@FreeBSD.org> | 2004-03-28 03:00:56 +0000 |
commit | 72d6e1aaae1fda541fcea91acd357044751527bb (patch) | |
tree | e2033c88833f0ec16959f163227c7aaf30e2d91f /bin/ps | |
parent | c148ed96ea64a200e4c71f13837647dc4613d06c (diff) | |
download | FreeBSD-src-72d6e1aaae1fda541fcea91acd357044751527bb.zip FreeBSD-src-72d6e1aaae1fda541fcea91acd357044751527bb.tar.gz |
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).
Diffstat (limited to 'bin/ps')
-rw-r--r-- | bin/ps/ps.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |