]> 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>
Sun, 8 Dec 2019 01:37:29 +0000 (02:37 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 92531e084c6e6f26ea366506627b242885816ab6..d8239577acaeeee6b3a9d8a802fae27920d1cb11 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;