]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups/cgfsng: rework cgfsng_mount()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 7 Dec 2019 23:40:29 +0000 (00:40 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 8 Dec 2019 01:37:35 +0000 (02:37 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 0f130ecf6e1b528d7265249990b8474122060b4d..506b0379baa364e512607d2f2d2689e0fb712f61 100644 (file)
@@ -1783,9 +1783,15 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
        int ret;
        bool has_cgns = false, retval = false, wants_force_mount = false;
 
+       if (!ops)
+               return ret_set_errno(false, ENOENT);
+
        if (!ops->hierarchies)
                return true;
 
+       if (!handler || !handler->conf)
+               return ret_set_errno(false, EINVAL);
+
        if ((type & LXC_AUTO_CGROUP_MASK) == 0)
                return true;
 
@@ -1845,10 +1851,10 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
                        continue;
 
                ret = mkdir(controllerpath, 0755);
-               if (ret < 0) {
-                       SYSERROR("Error creating cgroup path: %s", controllerpath);
-                       goto on_error;
-               }
+               if (ret < 0)
+                       log_error_errno(goto on_error, errno,
+                                       "Error creating cgroup path: %s",
+                                       controllerpath);
 
                if (has_cgns && wants_force_mount) {
                        /* If cgroup namespaces are supported but the container