]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups/cgfsng: rework cgfsng_get_hierarchies()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 7 Dec 2019 23:18:52 +0000 (00:18 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 7 Dec 2019 23:28:48 +0000 (00:28 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index f52d61dad550180b7ee8e89f47adf1524cbcac01..a3611c1308fc702fd9ba31b4fe9a609fe3145478 100644 (file)
@@ -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;