conf: add lxc_wants_cap() helper

parent 1865b640
......@@ -1831,10 +1831,7 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
}
if (!wants_force_mount) {
if (!lxc_list_empty(&handler->conf->keepcaps))
wants_force_mount = !in_caplist(CAP_SYS_ADMIN, &handler->conf->keepcaps);
else
wants_force_mount = in_caplist(CAP_SYS_ADMIN, &handler->conf->caps);
wants_force_mount = lxc_wants_cap(CAP_SYS_ADMIN, handler->conf);
/*
* Most recent distro versions currently have init system that
......
......@@ -501,6 +501,15 @@ __hidden extern int run_script(const char *name, const char *section, const char
__hidden extern int run_script_argv(const char *name, unsigned int hook_version, const char *section,
const char *script, const char *hookname, char **argsin);
__hidden extern int in_caplist(int cap, struct lxc_list *caps);
static inline int lxc_wants_cap(int cap, struct lxc_conf *conf)
{
if (!lxc_list_empty(&conf->keepcaps))
return !in_caplist(cap, &conf->keepcaps);
return in_caplist(cap, &conf->caps);
}
__hidden extern int setup_sysctl_parameters(struct lxc_list *sysctls);
__hidden extern int lxc_clear_sysctls(struct lxc_conf *c, const char *key);
__hidden extern int setup_proc_filesystem(struct lxc_list *procs, pid_t pid);
......
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