From b46a3ae82b2a8768b272d41ad2ce91da9d8dae14 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 506b0379b..cee154596 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.3