Unverified Commit 708e0653 by Stéphane Graber Committed by GitHub

Merge pull request #3603 from brauner/2020-12-15/bugfixes

confile: don't accidently alter lxc.cgroup.dir
parents 8a0e2272 c583072d
...@@ -1214,7 +1214,7 @@ static int set_config_hooks(const char *key, const char *value, ...@@ -1214,7 +1214,7 @@ static int set_config_hooks(const char *key, const char *value,
else if (strcmp(key + 9, "destroy") == 0) else if (strcmp(key + 9, "destroy") == 0)
return add_hook(lxc_conf, LXCHOOK_DESTROY, move_ptr(copy)); return add_hook(lxc_conf, LXCHOOK_DESTROY, move_ptr(copy));
return -1; return ret_errno(EINVAL);
} }
static int set_config_hooks_version(const char *key, const char *value, static int set_config_hooks_version(const char *key, const char *value,
...@@ -1759,6 +1759,9 @@ static int set_config_cgroup2_controller(const char *key, const char *value, ...@@ -1759,6 +1759,9 @@ static int set_config_cgroup2_controller(const char *key, const char *value,
static int set_config_cgroup_dir(const char *key, const char *value, static int set_config_cgroup_dir(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data) struct lxc_conf *lxc_conf, void *data)
{ {
if (strcmp(key, "lxc.cgroup.dir") != 0)
return ret_errno(EINVAL);
if (lxc_config_value_empty(value)) if (lxc_config_value_empty(value))
return clr_config_cgroup_dir(key, lxc_conf, NULL); return clr_config_cgroup_dir(key, lxc_conf, NULL);
...@@ -3688,6 +3691,9 @@ static int get_config_cgroup_dir(const char *key, char *retv, int inlen, ...@@ -3688,6 +3691,9 @@ static int get_config_cgroup_dir(const char *key, char *retv, int inlen,
int len; int len;
int fulllen = 0; int fulllen = 0;
if (strcmp(key, "lxc.cgroup.dir") != 0)
return ret_errno(EINVAL);
if (!retv) if (!retv)
inlen = 0; inlen = 0;
else else
...@@ -4607,6 +4613,9 @@ static inline int clr_config_cgroup2_controller(const char *key, ...@@ -4607,6 +4613,9 @@ static inline int clr_config_cgroup2_controller(const char *key,
static int clr_config_cgroup_dir(const char *key, struct lxc_conf *lxc_conf, static int clr_config_cgroup_dir(const char *key, struct lxc_conf *lxc_conf,
void *data) void *data)
{ {
if (strcmp(key, "lxc.cgroup.dir") != 0)
return ret_errno(EINVAL);
if (lxc_conf->cgroup_meta.dir) if (lxc_conf->cgroup_meta.dir)
free_disarm(lxc_conf->cgroup_meta.dir); free_disarm(lxc_conf->cgroup_meta.dir);
......
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