Skip to content

Commit

Permalink
confile: add clearer for lxc.init_uid
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Jul 16, 2017
1 parent b94f407 commit bcaa172
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/lxc/confile.c
Expand Up @@ -225,6 +225,7 @@ static int clr_config_init_cmd(const char *, struct lxc_conf *);

static int set_config_init_uid(const char *, const char *, struct lxc_conf *);
static int get_config_init_uid(const char *, char *, int, struct lxc_conf *);
static int clr_config_init_uid(const char *, struct lxc_conf *);

static int set_config_init_gid(const char *, const char *, struct lxc_conf *);
static int get_config_init_gid(const char *, char *, int, struct lxc_conf *);
Expand Down Expand Up @@ -298,7 +299,7 @@ static struct lxc_config_t config[] = {
{ "lxc.group", set_config_group, get_config_group, clr_config_group, },
{ "lxc.environment", set_config_environment, get_config_environment, clr_config_environment, },
{ "lxc.init_cmd", set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, },
{ "lxc.init_uid", set_config_init_uid, get_config_init_uid, NULL },
{ "lxc.init_uid", set_config_init_uid, get_config_init_uid, clr_config_init_uid, },
{ "lxc.init_gid", set_config_init_gid, get_config_init_gid, NULL },
{ "lxc.ephemeral", set_config_ephemeral, get_config_ephemeral, NULL },
};
Expand Down Expand Up @@ -2564,10 +2565,7 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
{
int ret = 0;

if (strcmp(key, "lxc.init_uid") == 0) {
c->init_uid = 0;

} else if (strcmp(key, "lxc.init_gid") == 0) {
if (strcmp(key, "lxc.init_gid") == 0) {
c->init_gid = 0;

} else if (strcmp(key, "lxc.ephemeral") == 0) {
Expand Down Expand Up @@ -3888,3 +3886,9 @@ static inline int clr_config_init_cmd(const char *key, struct lxc_conf *c)
c->init_cmd = NULL;
return 0;
}

static inline int clr_config_init_uid(const char *key, struct lxc_conf *c)
{
c->init_uid = 0;
return 0;
}

0 comments on commit bcaa172

Please sign in to comment.