]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: add clearer for lxc.limit{.*}
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 16:33:08 +0000 (18:33 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 16:44:50 +0000 (18:44 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index eac8350db8ef7d7ac6b16f9060a279f769ca41d7..6f13ae6d4bd57d0185115585c471abdc720ce77f 100644 (file)
@@ -254,6 +254,7 @@ static int clr_config_no_new_privs(const char *, struct lxc_conf *);
 
 static int set_config_limit(const char *, const char *, struct lxc_conf *);
 static int get_config_limit(const char *, char *, int, struct lxc_conf *);
+static int clr_config_limit(const char *, struct lxc_conf *);
 
 static struct lxc_config_t config[] = {
        { "lxc.arch",                 set_config_personality,          get_config_personality,       clr_config_personality,       },
@@ -326,7 +327,7 @@ static struct lxc_config_t config[] = {
        { "lxc.ephemeral",            set_config_ephemeral,            get_config_ephemeral,         clr_config_ephemeral,         },
        { "lxc.syslog",               set_config_syslog,               get_config_syslog,            clr_config_syslog,            },
        { "lxc.no_new_privs",         set_config_no_new_privs,         get_config_no_new_privs,      clr_config_no_new_privs,      },
-       { "lxc.limit",                set_config_limit,                get_config_limit,             NULL },
+       { "lxc.limit",                set_config_limit,                get_config_limit,             clr_config_limit,             },
 };
 
 struct signame {
@@ -2773,10 +2774,7 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
 {
        int ret = 0;
 
-       if (strncmp(key, "lxc.limit", 9) == 0) {
-               ret = lxc_clear_limits(c, key);
-
-       } else if (strcmp(key, "lxc.include") == 0) {
+       if (strcmp(key, "lxc.include") == 0) {
                lxc_clear_includes(c);
 
        } else {
@@ -4245,3 +4243,8 @@ static inline int clr_config_no_new_privs(const char *key, struct lxc_conf *c)
        c->no_new_privs = false;
        return 0;
 }
+
+static inline int clr_config_limit(const char *key, struct lxc_conf *c)
+{
+       return lxc_clear_limits(c, key);
+}