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

index 6ead385eb5492d1c64635652ca70e87583861ca1..7b85c3f6a16cc8fb7ecd2bde21e6ef0fa42b265a 100644 (file)
@@ -183,6 +183,7 @@ static int clr_config_cap_keep(const char *, struct lxc_conf *);
 
 static int set_config_console_logfile(const char *, const char *, struct lxc_conf *);
 static int get_config_console_logfile(const char *, char *, int, struct lxc_conf *);
+static int clr_config_console_logfile(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 *);
@@ -290,7 +291,7 @@ static struct lxc_config_t config[] = {
        { "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,          clr_config_cap_keep,          },
-       { "lxc.console.logfile",      set_config_console_logfile,      get_config_console_logfile,   NULL },
+       { "lxc.console.logfile",      set_config_console_logfile,      get_config_console_logfile,   clr_config_console_logfile,   },
        { "lxc.console",              set_config_console,              get_config_console,           clr_config_console,           },
        { "lxc.seccomp",              set_config_seccomp,              get_config_seccomp,           NULL },
        { "lxc.include",              set_config_includefile,          NULL,                         NULL },
@@ -2788,10 +2789,6 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
        } else if (strcmp(key, "lxc.ephemeral") == 0) {
                c->ephemeral = 0;
 
-       } else if (strcmp(key, "lxc.console.logfile") == 0) {
-               free(c->console.log_path);
-               c->console.log_path = NULL;
-
        } else if (strcmp(key, "lxc.autodev") == 0) {
                c->autodev = 1;
 
@@ -4183,3 +4180,10 @@ static inline int clr_config_console(const char *key, struct lxc_conf *c)
        return 0;
 }
 
+static inline int clr_config_console_logfile(const char *key,
+                                            struct lxc_conf *c)
+{
+       free(c->console.log_path);
+       c->console.log_path = NULL;
+       return 0;
+}