From 3a68cc1e0500c6643d281f4d67b8c6a61708eb4a Mon Sep 17 00:00:00 2001 From: LiFeng Date: Mon, 30 Dec 2019 04:50:28 -0500 Subject: [PATCH 137/138] lxc: fix bug in read proc Signed-off-by: LiFeng --- 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