]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxccontainer: enable daemonized app containers
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 10 Nov 2017 23:21:09 +0000 (00:21 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 11 Nov 2017 10:13:05 +0000 (11:13 +0100)
This enables daemonized application containers with our minimal init running as
pid one and the requested program running as second pid.

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

index 0f65621ba13c9d0bb791b8e1fdfe8d6c0031fe59..9146f80137bd6e0fafc5b9e8a5909da0a2a154ae 100644 (file)
@@ -812,18 +812,6 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
        if (!handler)
                return false;
 
-       if (useinit) {
-               TRACE("calling \"lxc_execute\"");
-               ret = lxc_execute(c->name, argv, 1, handler, c->config_path,
-                                 daemonize);
-               c->error_num = ret;
-
-               if (ret != 0)
-                       return false;
-
-               return true;
-       }
-
        /* If no argv was passed in, use lxc.init_cmd if provided in the
         * configuration
         */
@@ -1003,7 +991,10 @@ reboot:
                goto on_error;
        }
 
-       ret = lxc_start(c->name, argv, handler, c->config_path, daemonize);
+       if (useinit)
+               ret = lxc_execute(c->name, argv, 1, handler, c->config_path, daemonize);
+       else
+               ret = lxc_start(c->name, argv, handler, c->config_path, daemonize);
        c->error_num = ret;
 
        if (conf->reboot == 1) {