procps/0015-top-swat-bug-affecting-batch-mode-and-width-provisio.patch

40 lines
1.2 KiB
Diff
Raw Normal View History

From 06c19f5ba4e8fcb704936609e8ef7d328ca54a28 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 29 Aug 2013 00:00:00 -0500
Subject: [PATCH] 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>
---
top/top.c | 1 +
1 file changed, 1 insertion(+)
diff --git top/top.c top/top.c
index bdfcf20..9996fbf 100644
--- top/top.c
+++ 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;
}
--
1.7.9.2