From 832fb63a0b46c6275ed1d02c0c8bec5e53afc41e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 31 May 2017 18:25:51 +0200 Subject: [PATCH] confile: add clearer for lxc.environment Signed-off-by: Christian Brauner --- src/lxc/confile.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lxc/confile.c b/src/lxc/confile.c index d165e8d0a..3e96e5a96 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -226,6 +226,7 @@ static int clr_config_group(const char *, struct lxc_conf *); static int set_config_environment(const char *, const char *, struct lxc_conf *); static int get_config_environment(const char *, char *, int, struct lxc_conf *); +static int clr_config_environment(const char *, struct lxc_conf *); static int set_config_init_cmd(const char *, const char *, struct lxc_conf *); static int get_config_init_cmd(const char *, char *, int, struct lxc_conf *); @@ -313,7 +314,7 @@ static struct lxc_config_t config[] = { { "lxc.start.order", set_config_start, get_config_start, clr_config_start, }, { "lxc.monitor.unshare", set_config_monitor, get_config_monitor, clr_config_monitor, }, { "lxc.group", set_config_group, get_config_group, clr_config_group, }, - { "lxc.environment", set_config_environment, get_config_environment, NULL }, + { "lxc.environment", set_config_environment, get_config_environment, clr_config_environment, }, { "lxc.init_cmd", set_config_init_cmd, get_config_init_cmd, NULL }, { "lxc.init_uid", set_config_init_uid, get_config_init_uid, NULL }, { "lxc.init_gid", set_config_init_gid, get_config_init_gid, NULL }, @@ -2767,10 +2768,7 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key) { int ret = 0; - if (strncmp(key, "lxc.environment", 15) == 0) { - ret = lxc_clear_environment(c); - - } else if (strncmp(key, "lxc.limit", 9) == 0) { + if (strncmp(key, "lxc.limit", 9) == 0) { ret = lxc_clear_limits(c, key); } else if (strcmp(key, "lxc.init_cmd") == 0) { @@ -4222,4 +4220,8 @@ static inline int clr_config_group(const char *key, struct lxc_conf *c) { return lxc_clear_groups(c); } + +static inline int clr_config_environment(const char *key, struct lxc_conf *c) +{ + return lxc_clear_environment(c); }