Commit 487d8008 by Qiang Huang Committed by Stéphane Graber

lxccontainer: remove PID file after lxc_start return

Make the way symmetric. This also fix the file leak in daemon model. Signed-off-by: 's avatarQiang Huang <h.huangqiang@huawei.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent a684f0b7
...@@ -233,11 +233,6 @@ static void lxc_container_free(struct lxc_container *c) ...@@ -233,11 +233,6 @@ static void lxc_container_free(struct lxc_container *c)
free(c->config_path); free(c->config_path);
c->config_path = NULL; c->config_path = NULL;
} }
if (c->pidfile) {
unlink(c->pidfile);
free(c->pidfile);
c->pidfile = NULL;
}
free(c); free(c);
} }
...@@ -665,6 +660,12 @@ reboot: ...@@ -665,6 +660,12 @@ reboot:
goto reboot; goto reboot;
} }
if (c->pidfile) {
unlink(c->pidfile);
free(c->pidfile);
c->pidfile = NULL;
}
if (daemonize) if (daemonize)
exit (ret == 0 ? true : false); exit (ret == 0 ? true : false);
else else
......
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