lxc/0137-lxc-fix-bug-in-read-proc.patch

44 lines
1.3 KiB
Diff
Raw Normal View History

From b0164257a8f7e815e43fd6e586e1f30ee3ebd1dd Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68@huawei.com>
Date: Mon, 30 Dec 2019 04:50:28 -0500
Subject: [PATCH 137/139] lxc: fix bug in read proc
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
src/lxc/start.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 63be4e3..c9bae65 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -998,7 +998,7 @@ static int _recursive_read_cgroup_procs(const char *dirpath, pid_t **pids, size_
char pathname[PATH_MAX];
dir = opendir(dirpath);
- if (!dir && errno != ENOENT) {
+ if (dir == NULL) {
WARN("Failed to open \"%s\"", dirpath);
return 0;
}
@@ -1049,15 +1049,13 @@ static int _recursive_read_cgroup_procs(const char *dirpath, pid_t **pids, size_
int get_all_pids(struct cgroup_ops *cg_ops, pid_t **pids, size_t *len)
{
const char *devices_path = NULL;
- int ret;
devices_path = cg_ops->get_cgroup(cg_ops, "devices", false);
if (!file_exists(devices_path)) {
return 0;
}
- ret = _recursive_read_cgroup_procs(devices_path, pids, len);
- return ret;
+ return _recursive_read_cgroup_procs(devices_path, pids, len);
}
static int set_cgroup_freezer(struct cgroup_ops *cg_ops, const char *value)
--
1.8.3.1