]> git.proxmox.com Git - mirror_lxc.git/commitdiff
api_start: don't get a container reference for the daemonized case
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Sun, 19 Jan 2014 18:17:42 +0000 (12:17 -0600)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 23 Jan 2014 00:28:13 +0000 (18:28 -0600)
In the daemonized case we will fork, so the anonymous container memlock
will not be shared between parent and child.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxccontainer.c

index 70a85bdf42d344d5d3beb41f361b418c1d8d0a6e..167708d7db9cd7f6227073bfc8626683b89c15af 100644 (file)
@@ -589,15 +589,11 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
        * while container is running...
        */
        if (daemonize) {
-               if (!lxc_container_get(c))
-                       return false;
                lxc_monitord_spawn(c->config_path);
 
                pid_t pid = fork();
-               if (pid < 0) {
-                       lxc_container_put(c);
+               if (pid < 0)
                        return false;
-               }
                if (pid != 0)
                        return wait_on_daemonized_start(c, pid);
 
@@ -638,12 +634,10 @@ reboot:
                goto reboot;
        }
 
-       if (daemonize) {
-               lxc_container_put(c);
+       if (daemonize)
                exit (ret == 0 ? true : false);
-       } else {
+       else
                return (ret == 0 ? true : false);
-       }
 }
 
 /*