aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2017-03-07 04:51:35 +0000
committerConrad Meyer <cem@FreeBSD.org>2017-03-07 04:51:35 +0000
commitef1d40da16ce358605ad999b64dd15a924f96e57 (patch)
tree8a4a41d6b4e75155f30081d8957bad11cf9faeb4 /bin
parent60647474d9924bf86bd1de0b765a41b412f44e97 (diff)
downloadsrc-ef1d40da16ce358605ad999b64dd15a924f96e57.tar.gz
src-ef1d40da16ce358605ad999b64dd15a924f96e57.zip
ps(1): Fix -w + UNLIMITED handling
A follow-up fix for r314685. Because the -w flag is parsed after ps(1) infers termwidth from COLUMNS and stdout, and UNLIMITED happens to be the zero value, the single -w flag in combination with a non-terminal stdout or COLUMNS=0 could result in output truncated at 131 characters. (Despite the output being unlimited without -w.) Obviously, adding more -w shouldn't truncate output lines. The committed patch is from bdrewery@, and I've reviewed and tested it. Submitted by: bdrewery@ Reported by: bdrewery@ Sponsored by: Dell EMC Isilon
Notes
Notes: svn path=/head/; revision=314832
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/ps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 4fb0be9722ca..cb3e5e64aae5 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -401,7 +401,7 @@ main(int argc, char *argv[])
case 'w':
if (wflag)
termwidth = UNLIMITED;
- else if (termwidth < 131)
+ else if (termwidth < 131 && termwidth != UNLIMITED)
termwidth = 131;
wflag++;
break;