top: fix potential SEGV when no tasks were displayable
This patch fixes a nearly decade old bug discovered by Frederik Deweerdt. His merge request shown below would be an adequate solution except for iterative overhead. This alternate patch will represent substantially less overhead for an admittedly extremely rare possibility. Reference(s): https://gitlab.com/procps-ng/procps/-/merge_requests/114 And-thanks-to: Frederik Deweerdt <fdeweerdt@fastly.com> Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
7a19961fc2
commit
f57a0301e3
1
NEWS
1
NEWS
@ -13,6 +13,7 @@ procps-ng NEXT
|
|||||||
* top: add command line 'e' for symmetry with 'E' issue #165
|
* top: add command line 'e' for symmetry with 'E' issue #165
|
||||||
* top: add '4' toggle for two abreast cpu display issue #172
|
* top: add '4' toggle for two abreast cpu display issue #172
|
||||||
* top: add '!' toggle for combining multiple cpus
|
* top: add '!' toggle for combining multiple cpus
|
||||||
|
* top: fix potential SEGV involving -p switch merge #114
|
||||||
* vmstat: Wide mode gives wider proc columns merge #48
|
* vmstat: Wide mode gives wider proc columns merge #48
|
||||||
* watch: Add environment variable for interval merge #62
|
* watch: Add environment variable for interval merge #62
|
||||||
|
|
||||||
|
@ -6486,6 +6486,8 @@ static int window_show (WIN_t *q, int wmax) {
|
|||||||
|
|
||||||
// Display Column Headings -- and distract 'em while we sort (maybe)
|
// Display Column Headings -- and distract 'em while we sort (maybe)
|
||||||
PUFF("\n%s%s%s", q->capclr_hdr, q->columnhdr, Caps_endline);
|
PUFF("\n%s%s%s", q->capclr_hdr, q->columnhdr, Caps_endline);
|
||||||
|
// and just in case 'Monpids' is active but matched no processes ...
|
||||||
|
if (!Frame_maxtask) return 1; // 1 for the column header
|
||||||
|
|
||||||
if (CHKw(q, Show_FOREST))
|
if (CHKw(q, Show_FOREST))
|
||||||
forest_create(q);
|
forest_create(q);
|
||||||
|
Loading…
Reference in New Issue
Block a user