git: a4bd2216fb52 - stable/13 - ps: fix `ps -aa`
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Mar 2022 18:53:57 UTC
The branch stable/13 has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=a4bd2216fb5250cee32ed9eb4090fc518018a26c commit a4bd2216fb5250cee32ed9eb4090fc518018a26c Author: Math Ieu <sigsys@gmail.com> AuthorDate: 2021-09-24 06:58:40 +0000 Commit: Piotr Pawel Stefaniak <pstef@FreeBSD.org> CommitDate: 2022-03-22 18:46:40 +0000 ps: fix `ps -aa` Passing the -a flag multiple times made ps show no processes. Differential Revision: https://reviews.freebsd.org/D27215 (cherry picked from commit bf27a2253f6ba6ee3086046b837b2fe40e22c72c) --- bin/ps/ps.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bin/ps/ps.c b/bin/ps/ps.c index d3cfc669d581..0c656d8a1544 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -253,11 +253,9 @@ main(int argc, char *argv[]) * added for compatibility with SUSv3, but for * now it will not be described in the man page. */ - nselectors++; all = xkeep = 1; break; case 'a': - nselectors++; all = 1; break; case 'C': @@ -473,7 +471,7 @@ main(int argc, char *argv[]) if (!_fmt) parsefmt(dfmt, 0); - if (nselectors == 0) { + if (!all && nselectors == 0) { uidlist.l.ptr = malloc(sizeof(uid_t)); if (uidlist.l.ptr == NULL) xo_errx(1, "malloc failed"); @@ -526,9 +524,6 @@ main(int argc, char *argv[]) what = KERN_PROC_UID | showthreads; flag = *uidlist.l.uids; nselectors = 0; - } else if (all) { - /* No need for this routine to select processes. */ - nselectors = 0; } }