From: Christian Brauner Date: Wed, 6 Dec 2017 14:37:40 +0000 (+0100) Subject: lxccontainer: handle execute containers correctly X-Git-Tag: lxc-2.0.10~510 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1d3676c048e04ffc35a741385884d223bed8004;p=thirdparty%2Flxc.git lxccontainer: handle execute containers correctly It doesn't make sense to error out when an app container doesn't pass explicit arguments through c->start{l}(). This is especially true since we implemented lxc.execute.cmd. However, even before we could have always relied on lxc.init.cmd and errored out after that. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 608eb85fe..97d34fa9c 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -799,10 +799,6 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a return false; } - /* Is this app meant to be run through lxcinit, as in lxc-execute? */ - if (useinit && !argv) - return false; - if (container_mem_lock(c)) return false; conf = c->lxc_conf; @@ -814,15 +810,16 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a if (!handler) return false; - /* If no argv was passed in, use lxc.init_cmd if provided in the - * configuration - */ if (!argv) argv = init_cmd = split_init_cmd(conf->init_cmd); /* ... otherwise use default_args. */ - if (!argv) - argv = default_args; + if (!argv) { + if (useinit) + return false; + else + argv = default_args; + } /* I'm not sure what locks we want here.Any? Is liblxc's locking enough * here to protect the on disk container? We don't want to exclude