summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2004-05-23 21:21:07 +0000
committergad <gad@FreeBSD.org>2004-05-23 21:21:07 +0000
commit4680df73af087d5d9a4c31114f623245da99ec77 (patch)
tree417e88da5bce7f58bb917beec3254b2767d84aab /bin
parent170d03a0c9fddf1f1a42da03139f4e14bf1449e4 (diff)
downloadFreeBSD-src-4680df73af087d5d9a4c31114f623245da99ec77.zip
FreeBSD-src-4680df73af087d5d9a4c31114f623245da99ec77.tar.gz
Fix the kludge-old-options processing so `ps tpt' will be treated the
same as `ps -tpt', instead of being changed into `ps -tpT'. PR: bin/52489 Submitted by: Jilles Tjoelker MFC after: 1 week
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/ps.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 5a65aa4..b2b7b27 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1104,11 +1104,12 @@ kludge_oldps_options(char *s)
* of the oldps options -- option string NOT starting with a '-' --
* then convert to 'T' (meaning *this* terminal, i.e. ttyname(0)).
*
- * However, if a flag accepting a string argument is found in the
- * option string, the remainder of the string is the argument to
- * that flag; do not modify that argument.
+ * However, if a flag accepting a string argument is found earlier
+ * in the option string (including a possible `t' flag), then the
+ * remainder of the string must be the argument to that flag; so
+ * do not modify that argument.
*/
- if (strcspn(s, "MNOoU") == len && *cp == 't' && *s != '-')
+ if (*cp == 't' && *s != '-' && strcspn(s, "MNOoUt") == len - 1)
*cp = 'T';
else {
/*
OpenPOWER on IntegriCloud