summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2013-08-29 00:00:00 -0500
committerCraig Small <csmall@enc.com.au>2013-08-30 22:08:26 +1000
commit06c19f5ba4e8fcb704936609e8ef7d328ca54a28 (patch)
treef2f27b8f9999cfed459e451374f005ad5108177b
parent819ede1a6bc25d732cf84d15c48be9ca86f336a2 (diff)
downloadprocps-ng-06c19f5ba4e8fcb704936609e8ef7d328ca54a28.tar.gz
top: swat bug affecting batch mode and width provision
Normally, the internally tracked 'Screen_cols' can not exceed the lessor of 512 or actual screen width. There was one case, however, where that 512 byte upper limit was no longer properly imposed as it should have been. When operating in 'Batch' mode the actual screen width was allowed to be exceeded when the optional -w switch was also used. But, it should never have exceeded 512. This patch ensures the upper limit is always observed. Reference(s): http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721204 Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r--top/top.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/top/top.c b/top/top.c
index bdfcf20..9996fbf 100644
--- a/top/top.c
+++ b/top/top.c
@@ -1792,6 +1792,7 @@ static void adj_geometry (void) {
if (w_cols && w_cols < W_MIN_COL) w_cols = W_MIN_COL;
if (w_rows && w_rows < W_MIN_ROW) w_rows = W_MIN_ROW;
}
+ if (w_cols > SCREENMAX) w_cols = SCREENMAX;
w_set = 1;
}