]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: add getter for lxc.init_gid
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 07:18:14 +0000 (09:18 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 08:03:34 +0000 (10:03 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 01155e87d062250aedae2d5ca5cbaddf2ae0c063..cecb96cc9bb2426cd13921ef33f60f1bd12eb964 100644 (file)
@@ -201,6 +201,8 @@ static int set_config_init_uid(const char *, const char *, struct lxc_conf *);
 static int get_config_init_uid(struct lxc_container *, const char *, char *, int);
 
 static int set_config_init_gid(const char *, const char *, struct lxc_conf *);
+static int get_config_init_gid(struct lxc_container *, const char *, char *, int);
+
 static int set_config_ephemeral(const char *, const char *, struct lxc_conf *);
 static int set_config_no_new_privs(const char *, const char *, struct lxc_conf *);
 static int set_config_limit(const char *, const char *, struct lxc_conf *);
@@ -272,7 +274,7 @@ static struct lxc_config_t config[] = {
        { "lxc.environment",          set_config_environment,          get_config_environment,       NULL},
        { "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,              NULL, NULL},
+       { "lxc.init_gid",             set_config_init_gid,             get_config_init_gid,          NULL},
        { "lxc.ephemeral",            set_config_ephemeral,             NULL, NULL},
        { "lxc.syslog",               set_config_syslog,               get_config_syslog,            NULL},
        { "lxc.no_new_privs",         set_config_no_new_privs,      NULL, NULL},
@@ -2720,9 +2722,7 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv,
 {
        const char *v = NULL;
 
-       if (strcmp(key, "lxc.init_gid") == 0)
-               return lxc_get_conf_int(c, retv, inlen, c->init_gid);
-       else if (strcmp(key, "lxc.ephemeral") == 0)
+       if (strcmp(key, "lxc.ephemeral") == 0)
                return lxc_get_conf_int(c, retv, inlen, c->ephemeral);
        else if (strcmp(key, "lxc.no_new_privs") == 0)
                return lxc_get_conf_int(c, retv, inlen, c->no_new_privs);
@@ -3987,3 +3987,10 @@ static int get_config_init_uid(struct lxc_container *c, const char *key,
        return lxc_get_conf_int(c->lxc_conf, retv, inlen,
                                c->lxc_conf->init_uid);
 }
+
+static int get_config_init_gid(struct lxc_container *c, const char *key,
+                              char *retv, int inlen)
+{
+       return lxc_get_conf_int(c->lxc_conf, retv, inlen,
+                               c->lxc_conf->init_gid);
+}