top: fix additional SEGVs if no tasks were displayable
This patch is an outgrowth of that commit shown below.
Many additional potential segmentation faults might be
encountered if interactive commands are opened up to a
user when a '-p' switch has a single non-existent pid.
[ always the 'k', 'L', 'r', 'Y' keys & maybe 'v' too ]
So, this patch will restrict such a loser (oops, user)
to a reduced subset of normal commands until he/she/it
quits then restarts top with something to be displayed
or issues the '=' command overriding that '-p' switch.
Reference(s):
commit d3203d99dd
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
b0e7a52f65
commit
da02101513
@ -5474,6 +5474,8 @@ static void do_key (int ch) {
|
|||||||
write_rcfile();
|
write_rcfile();
|
||||||
goto all_done;
|
goto all_done;
|
||||||
default: // and now, the real work...
|
default: // and now, the real work...
|
||||||
|
// and just in case 'Monpids' is active but matched no processes ...
|
||||||
|
if (!PIDSmaxt && ch != '=') goto all_done;
|
||||||
for (i = 0; i < MAXTBL(key_tab); ++i)
|
for (i = 0; i < MAXTBL(key_tab); ++i)
|
||||||
if (strchr(key_tab[i].keys, ch)) {
|
if (strchr(key_tab[i].keys, ch)) {
|
||||||
key_tab[i].func(ch);
|
key_tab[i].func(ch);
|
||||||
|
Loading…
Reference in New Issue
Block a user