From: Christian Brauner Date: Sat, 7 Dec 2019 23:18:52 +0000 (+0100) Subject: cgroups/cgfsng: rework cgfsng_get_hierarchies() X-Git-Tag: lxc-4.0.0~78^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa48a34fac85d825d4bbf116521e1176db1230f2;p=thirdparty%2Flxc.git cgroups/cgfsng: rework cgfsng_get_hierarchies() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index f52d61dad..a3611c130 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1978,24 +1978,27 @@ __cgfsng_ops static int cgfsng_num_hierarchies(struct cgroup_ops *ops) return i; } -__cgfsng_ops static bool cgfsng_get_hierarchies(struct cgroup_ops *ops, int n, char ***out) +__cgfsng_ops static bool cgfsng_get_hierarchies(struct cgroup_ops *ops, int n, + char ***out) { int i; + if (!ops) + return ret_set_errno(false, ENOENT); + if (!ops->hierarchies) return false; /* sanity check n */ for (i = 0; i < n; i++) if (!ops->hierarchies[i]) - return false; + return ret_set_errno(false, ENOENT); *out = ops->hierarchies[i]->controllers; return true; } - static bool cg_legacy_freeze(struct cgroup_ops *ops) { __do_free char *path = NULL;