]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: add clearer for lxc.cap.keep
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 16:05:13 +0000 (18:05 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 16:05:13 +0000 (18:05 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 5871cd5f6348f882bc18e5d36769c52f40fee4e3..778329a5482b6839ee3fbd5673269754454a1aa1 100644 (file)
@@ -179,6 +179,7 @@ static int clr_config_cap_drop(const char *, struct lxc_conf *);
 
 static int set_config_cap_keep(const char *, const char *, struct lxc_conf *);
 static int get_config_cap_keep(const char *, char *, int, struct lxc_conf *);
+static int clr_config_cap_keep(const char *, struct lxc_conf *);
 
 static int set_config_console(const char *, const char *, struct lxc_conf *);
 static int get_config_console(const char *, char *, int, struct lxc_conf *);
@@ -287,7 +288,7 @@ static struct lxc_config_t config[] = {
        { "lxc.network.",             set_config_network_nic,          get_config_network_item,      clr_config_network_item,      },
        { "lxc.network",              set_config_network,              get_config_network,           clr_config_network,           },
        { "lxc.cap.drop",             set_config_cap_drop,             get_config_cap_drop,          clr_config_cap_drop,          },
-       { "lxc.cap.keep",             set_config_cap_keep,             get_config_cap_keep,          NULL },
+       { "lxc.cap.keep",             set_config_cap_keep,             get_config_cap_keep,          clr_config_cap_keep,          },
        { "lxc.console.logfile",      set_config_console_logfile,      get_config_console_logfile,   NULL },
        { "lxc.console",              set_config_console,              get_config_console,           NULL },
        { "lxc.seccomp",              set_config_seccomp,              get_config_seccomp,           NULL },
@@ -2755,10 +2756,7 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
 {
        int ret = 0;
 
-       if (strcmp(key, "lxc.cap.keep") == 0) {
-               ret = lxc_clear_config_keepcaps(c);
-
-       } else if (strncmp(key, "lxc.group", 9) == 0) {
+       if (strncmp(key, "lxc.group", 9) == 0) {
                ret = lxc_clear_groups(c);
 
        } else if (strncmp(key, "lxc.environment", 15) == 0) {
@@ -4175,3 +4173,8 @@ static inline int clr_config_cap_drop(const char *key, struct lxc_conf *c)
 {
        return lxc_clear_config_caps(c);
 }
+
+static inline int clr_config_cap_keep(const char *key, struct lxc_conf *c)
+{
+       return lxc_clear_config_keepcaps(c);
+}