]> git.proxmox.com Git - mirror_lxc.git/commitdiff
lxccontainer: remove PID file after lxc_start return
authorQiang Huang <h.huangqiang@huawei.com>
Fri, 24 Jan 2014 03:41:27 +0000 (11:41 +0800)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 26 Jan 2014 00:09:14 +0000 (19:09 -0500)
Make the way symmetric. This also fix the file leak in
daemon model.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxccontainer.c

index 6ea7c113e3086c97d94960509aa4e8e7c1f93678..d0c5e07ac8c6ee8cf05a45947ed5b2db94877345 100644 (file)
@@ -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