psmisc/backport-0002-pstree-additional-for-do-not-crash-on-missing-proces.patch
2020-11-03 16:08:43 +08:00

34 lines
977 B
Diff

From b6c2b1288bd99f52d962301a2e41a0102d2a2d35 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Fri, 15 Nov 2019 09:53:12 +1100
Subject: [PATCH 47/65] pstree: additional for do not crash on missing
processes
https://gitlab.com/psmisc/psmisc/-/commit/b6c2b1288bd99f52d962301a2e41a0102d2a2d35
This patch has been modified to fit euler os
Signed-off-by: chenmingmin <chenmingmin@huawei.com>
---
src/pstree.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/pstree.c b/src/pstree.c
index 3de0792..b05822e 100644
--- a/src/pstree.c
+++ b/src/pstree.c
@@ -1030,8 +1030,9 @@ static void read_proc(void)
#ifdef WITH_SELINUX
if (selinux_enabled)
if (getpidcon(pid, &scontext) < 0) {
- perror(path);
- exit(1);
+ (void) fclose(file);
+ free(path);
+ continue;
}
#endif /*WITH_SELINUX */
if (stat(path, &st) < 0) {
--
2.22.0.windows.1