diff options
| author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2017-10-06 15:09:28 +0000 |
|---|---|---|
| committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2017-10-06 15:09:28 +0000 |
| commit | d7026b9671c0071dc112169b8349b02fa7cfd470 (patch) | |
| tree | 88e9e7866aa70d58de9d8bba63ae8e8d15140f23 /bin | |
| parent | a4730cdb8207a690f4763f66cf61fbf94906eb6d (diff) | |
Notes
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/ps/ps.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c index cb3e5e64aae5..40dc4f77f6b2 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -523,7 +523,11 @@ main(int argc, char *argv[]) */ nentries = -1; kp = kvm_getprocs(kd, what, flag, &nentries); - if ((kp == NULL && nentries > 0) || (kp != NULL && nentries < 0)) + /* + * Ignore ESRCH to preserve behaviour of "ps -p nonexistent-pid" + * not reporting an error. + */ + if ((kp == NULL && errno != ESRCH) || (kp != NULL && nentries < 0)) xo_errx(1, "%s", kvm_geterr(kd)); nkept = 0; if (nentries > 0) { |
