summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/ps/ps.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 1bb1e50..98fec49 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -591,9 +591,16 @@ pscomp(const void *a, const void *b)
static char *
kludge_oldps_options(char *s)
{
+ int have_fmt;
size_t len;
char *newopts, *ns, *cp;
+ /*
+ * If we have an 'o' option, then note it, since we don't want to do
+ * some types of munging.
+ */
+ have_fmt = index(s, 'o') != NULL;
+
len = strlen(s);
if ((newopts = ns = malloc(len + 2)) == NULL)
errx(1, "malloc failed");
@@ -634,7 +641,7 @@ kludge_oldps_options(char *s)
*/
if (isdigit(*cp) &&
(cp == s || (cp[-1] != 't' && cp[-1] != 'p')) &&
- (cp - 1 == s || cp[-2] != 't'))
+ (cp - 1 == s || cp[-2] != 't') && !have_fmt)
*ns++ = 'p';
(void)strcpy(ns, cp); /* and append the number */
OpenPOWER on IntegriCloud