Skip to content

Commit

Permalink
api_start: don't get a container reference for the daemonized case
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hallyn committed Jan 23, 2014
1 parent 2eee1b9 commit 844f7a3
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/lxc/lxccontainer.c
Expand Up @@ -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);

Expand Down Expand Up @@ -638,12 +634,10 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
goto reboot;
}

if (daemonize) {
lxc_container_put(c);
if (daemonize)
exit (ret == 0 ? true : false);
} else {
else
return (ret == 0 ? true : false);
}
}

/*
Expand Down

0 comments on commit 844f7a3

Please sign in to comment.