Commit 844f7a38 by Serge Hallyn

api_start: don't get a container reference for the daemonized case

In the daemonized case we will fork, so the anonymous container memlock will not be shared between parent and child. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent 2eee1b96
...@@ -589,15 +589,11 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv ...@@ -589,15 +589,11 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
* while container is running... * while container is running...
*/ */
if (daemonize) { if (daemonize) {
if (!lxc_container_get(c))
return false;
lxc_monitord_spawn(c->config_path); lxc_monitord_spawn(c->config_path);
pid_t pid = fork(); pid_t pid = fork();
if (pid < 0) { if (pid < 0)
lxc_container_put(c);
return false; return false;
}
if (pid != 0) if (pid != 0)
return wait_on_daemonized_start(c, pid); return wait_on_daemonized_start(c, pid);
...@@ -638,12 +634,10 @@ reboot: ...@@ -638,12 +634,10 @@ reboot:
goto reboot; goto reboot;
} }
if (daemonize) { if (daemonize)
lxc_container_put(c);
exit (ret == 0 ? true : false); exit (ret == 0 ? true : false);
} else { else
return (ret == 0 ? true : false); return (ret == 0 ? true : false);
}
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment