From: Christian Brauner Date: Fri, 19 Feb 2021 23:42:51 +0000 (+0100) Subject: cgroups: tweak lxc.cgroup.use handling in __cgroup_init() X-Git-Tag: lxc-5.0.0~274^2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fbf99d6005a906805565e521fa28dabbb8ca4a0;p=thirdparty%2Flxc.git cgroups: tweak lxc.cgroup.use handling in __cgroup_init() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 49ae6dee1..d41a8ed88 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -3493,7 +3493,7 @@ static int __cgroup_init(struct cgroup_ops *ops, struct lxc_conf *conf) { __do_close int dfd = -EBADF; int ret; - const char *tmp; + const char *controllers_use; if (ops->dfd_mnt_cgroupfs_host >= 0) return ret_errno(EINVAL); @@ -3508,18 +3508,17 @@ static int __cgroup_init(struct cgroup_ops *ops, struct lxc_conf *conf) if (dfd < 0) return syserrno(-errno, "Failed to open " DEFAULT_CGROUP_MOUNTPOINT); - tmp = lxc_global_config_value("lxc.cgroup.use"); - if (tmp) { - __do_free char *pin = NULL; - char *chop, *cur; + controllers_use = lxc_global_config_value("lxc.cgroup.use"); + if (controllers_use) { + __do_free char *dup = NULL; + char *it; - pin = strdup(tmp); - if (!pin) + dup = strdup(controllers_use); + if (!dup) return -errno; - chop = pin; - lxc_iterate_parts(cur, chop, ",") - must_append_string(&ops->cgroup_use, cur); + lxc_iterate_parts(it, dup, ",") + must_append_string(&ops->cgroup_use, it); } /*