From: Qiang Huang Date: Fri, 24 Jan 2014 03:41:27 +0000 (+0800) Subject: lxccontainer: remove PID file after lxc_start return X-Git-Tag: lxc-1.0.0.beta3~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=487d80082ff1800198a5b7359ebc5f416a6f6bde;p=thirdparty%2Flxc.git lxccontainer: remove PID file after lxc_start return Make the way symmetric. This also fix the file leak in daemon model. Signed-off-by: Qiang Huang Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 6ea7c113e..d0c5e07ac 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -233,11 +233,6 @@ static void lxc_container_free(struct lxc_container *c) free(c->config_path); c->config_path = NULL; } - if (c->pidfile) { - unlink(c->pidfile); - free(c->pidfile); - c->pidfile = NULL; - } free(c); } @@ -665,6 +660,12 @@ reboot: goto reboot; } + if (c->pidfile) { + unlink(c->pidfile); + free(c->pidfile); + c->pidfile = NULL; + } + if (daemonize) exit (ret == 0 ? true : false); else