]> granicus.if.org Git - procps-ng/commitdiff
top: fix a segfault when -p switch specified invalid pid
authorJim Warner <james.warner@comcast.net>
Wed, 11 Apr 2012 09:11:12 +0000 (04:11 -0500)
committerCraig Small <csmall@enc.com.au>
Sun, 15 Apr 2012 00:25:05 +0000 (10:25 +1000)
In attempting to keep at least one task visible when
scrolling vertically, a negative task index would be
produced when pid monitoring was in effect and no
matching pid was found.

Since there were already other conditions where no
task might displayed, the faulty source line has been
removed.

Bug-Debian: http://bugs.debian.org/668335

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c

index 65498a13393451fa06378306e8fed2c1713aace6..c081af3534b6244a2b3c1eccaa260d26065d5002 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -3774,7 +3774,6 @@ static int window_show (WIN_t *q, int wmax) {
    }
 
    i = q->begtask;
-   if (i >= Frame_maxtask) i = q->begtask = Frame_maxtask - 1;
    lwin = 1;                                        // 1 for the column header
    wmax = winMIN(wmax, q->winlines + 1);            // ditto for winlines, too