From: Christian Brauner Date: Sat, 7 Dec 2019 23:40:29 +0000 (+0100) Subject: cgroups/cgfsng: rework cgfsng_mount() X-Git-Tag: lxc-4.0.0~78^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9585ccb3f03c7fa9c081fb07e66729ebed8016bc;p=thirdparty%2Flxc.git cgroups/cgfsng: rework cgfsng_mount() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 38513ca57..0ce7258f0 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -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