Author: kib Date: Tue Sep 29 00:20:58 2020 New Revision: 366237 URL: https://svnweb.freebsd.org/changeset/base/366237
Log: procstat: Fix regression after 365880. Basically it reverts one chunk that reversed the parsing logic, making legacy variants of invocation, like `procstat -a -f', non-operational. Reported and tested by: Dewayne Geraghty <dewa...@heuristicsystems.com.au> Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/usr.bin/procstat/procstat.c Modified: head/usr.bin/procstat/procstat.c ============================================================================== --- head/usr.bin/procstat/procstat.c Mon Sep 28 22:16:29 2020 (r366236) +++ head/usr.bin/procstat/procstat.c Tue Sep 29 00:20:58 2020 (r366237) @@ -425,9 +425,7 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - if (cmd == NULL && argv[0] != NULL) - cmd = getcmd(argv[0]); - if (cmd != NULL) { + if (cmd == NULL && argv[0] != NULL && (cmd = getcmd(argv[0])) != NULL) { if ((procstat_opts & PS_SUBCOMMAND_OPTS) != 0) usage(cmd); if (cmd->opt != NULL) { @@ -443,12 +441,13 @@ main(int argc, char *argv[]) argv += 1; } } else { - cmd = getcmd("basic"); + if (cmd == NULL) + cmd = getcmd("basic"); + if (cmd->cmd != procstat_files && + (procstat_opts & PS_OPT_CAPABILITIES) != 0 && + (cmd->cmp & PS_MODE_COMPAT) == 0) + usage(cmd); } - if (cmd->cmd != procstat_files && - (procstat_opts & PS_OPT_CAPABILITIES) != 0 && - (cmd->cmp & PS_MODE_COMPAT) == 0) - usage(cmd); /* Must specify either the -a flag or a list of pids. */ if (!(aflag == 1 && argc == 0) && !(aflag == 0 && argc > 0)) _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"