From: Christian Brauner Date: Wed, 31 May 2017 07:14:47 +0000 (+0200) Subject: confile: add getter for lxc.init_cmd X-Git-Tag: lxc-2.1.0~110^2~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96dfcb7d022d481669f77f11d25009e72867107b;p=thirdparty%2Flxc.git confile: add getter for lxc.init_cmd Signed-off-by: Christian Brauner --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index ec546f589..136546d63 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -195,6 +195,8 @@ static int set_config_environment(const char *, const char *, struct lxc_conf *) static int get_config_environment(struct lxc_container *, const char *, char *, int); static int set_config_init_cmd(const char *, const char *, struct lxc_conf *); +static int get_config_init_cmd(struct lxc_container *, const char *, char *, int); + static int set_config_init_uid(const char *, const char *, struct lxc_conf *); static int set_config_init_gid(const char *, const char *, struct lxc_conf *); static int set_config_ephemeral(const char *, const char *, struct lxc_conf *); @@ -266,7 +268,7 @@ static struct lxc_config_t config[] = { { "lxc.monitor.unshare", set_config_monitor, get_config_monitor, NULL}, { "lxc.group", set_config_group, get_config_group, NULL}, { "lxc.environment", set_config_environment, get_config_environment, NULL}, - { "lxc.init_cmd", set_config_init_cmd, NULL, NULL}, + { "lxc.init_cmd", set_config_init_cmd, get_config_init_cmd, NULL}, { "lxc.init_uid", set_config_init_uid, NULL, NULL}, { "lxc.init_gid", set_config_init_gid, NULL, NULL}, { "lxc.ephemeral", set_config_ephemeral, NULL, NULL}, @@ -2716,9 +2718,7 @@ int lxc_get_config_item(struct lxc_conf *c, const char *key, char *retv, { const char *v = NULL; - if (strcmp(key, "lxc.init_cmd") == 0) - v = c->init_cmd; - else if (strcmp(key, "lxc.init_uid") == 0) + if (strcmp(key, "lxc.init_uid") == 0) return lxc_get_conf_int(c, retv, inlen, c->init_uid); else if (strcmp(key, "lxc.init_gid") == 0) return lxc_get_conf_int(c, retv, inlen, c->init_gid); @@ -3974,3 +3974,9 @@ static int get_config_environment(struct lxc_container *c, const char *key, } return fulllen; } + +static int get_config_init_cmd(struct lxc_container *c, const char *key, + char *retv, int inlen) +{ + return lxc_get_conf_str(retv, inlen, c->lxc_conf->init_cmd); +}