From 1aae36a98fa51b66f09807e1aa0bdd470ce2f8da Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sun, 8 Dec 2019 00:41:36 +0100 Subject: [PATCH] cgroups/cgfsng: rework cgfsng_nrtasks() Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfsng.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 0ce7258f0..f6e7a9df6 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1933,8 +1933,11 @@ __cgfsng_ops static int cgfsng_nrtasks(struct cgroup_ops *ops) { __do_free char *path = NULL; + if (!ops) + return ret_set_errno(-1, ENOENT); + if (!ops->container_cgroup || !ops->hierarchies) - return -1; + return ret_set_errno(-1, EINVAL); path = must_make_path(ops->hierarchies[0]->container_full_path, NULL); return recursive_count_nrtasks(path); -- 2.47.2