cgroups/cgfsng: rework cgfsng_chown()

parent 78bda28d
...@@ -1621,26 +1621,32 @@ static int chown_cgroup_wrapper(void *data) ...@@ -1621,26 +1621,32 @@ static int chown_cgroup_wrapper(void *data)
} }
__cgfsng_ops static bool cgfsng_chown(struct cgroup_ops *ops, __cgfsng_ops static bool cgfsng_chown(struct cgroup_ops *ops,
struct lxc_conf *conf) struct lxc_conf *conf)
{ {
struct generic_userns_exec_data wrap; struct generic_userns_exec_data wrap;
if (lxc_list_empty(&conf->id_map)) if (!ops)
return true; return ret_set_errno(false, ENOENT);
if (!ops->hierarchies) if (!ops->hierarchies)
return true; return true;
if (!ops->container_cgroup)
return ret_set_errno(false, ENOENT);
if (!conf)
return ret_set_errno(false, EINVAL);
if (lxc_list_empty(&conf->id_map))
return true;
wrap.origuid = geteuid(); wrap.origuid = geteuid();
wrap.path = NULL; wrap.path = NULL;
wrap.hierarchies = ops->hierarchies; wrap.hierarchies = ops->hierarchies;
wrap.conf = conf; wrap.conf = conf;
if (userns_exec_1(conf, chown_cgroup_wrapper, &wrap, if (userns_exec_1(conf, chown_cgroup_wrapper, &wrap, "chown_cgroup_wrapper") < 0)
"chown_cgroup_wrapper") < 0) { return log_error_errno(false, errno, "Error requesting cgroup chown in new user namespace");
ERROR("Error requesting cgroup chown in new user namespace");
return false;
}
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment