1 Star 0 Fork 25

EulerOSWander/procps-ng

forked from src-openEuler/procps-ng 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-0010-top-fix-additional-SEGVs-if-no-tasks-were-displayabl.patch 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
吴超超 提交于 2020-11-03 14:28 . sync patchs
From 6e1715d9ebcffd7a673cbacbca4416c42d103c7b Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Sun, 13 Sep 2020 00:00:00 -0500
Subject: [PATCH] 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 f57a0301e3adfa5fd456404a200182c7f21da03a
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/top/top.c b/top/top.c
index 1147938..2afe648 100644
--- a/top/top.c
+++ b/top/top.c
@@ -5897,6 +5897,8 @@ static void do_key (int ch) {
write_rcfile();
goto all_done;
default: // and now, the real work...
+ // and just in case 'Monpids' is active but matched no processes ...
+ if (!Frame_maxtask && ch != '=') goto all_done;
for (i = 0; i < MAXTBL(key_tab); ++i)
if (strchr(key_tab[i].keys, ch)) {
key_tab[i].func(ch);
--
2.22.0.windows.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/euleroswander/procps-ng.git
git@gitee.com:euleroswander/procps-ng.git
euleroswander
procps-ng
procps-ng
master

搜索帮助