]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxccontainer: handle execute containers correctly
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 6 Dec 2017 14:37:40 +0000 (15:37 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 15 Dec 2017 12:01:22 +0000 (13:01 +0100)
It doesn't make sense to error out when an app container doesn't pass explicit
arguments through c->start{l}().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/lxccontainer.c

index 34ddc6e47a2ce2d1f727b8150badc9ca68d56bdc..d47e025cfb2e82502e0b15d45c243d7c3dde8bd5 100644 (file)
@@ -805,10 +805,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;
@@ -820,15 +816,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