Do so before we rm the containerdir.  Otherwise if the logfile is set
to $lxcpath/$name/log, the containerdir won't be fully deleted.

Signed-off-by: Serge Hallyn <[email protected]>
---
 src/lxc/lxccontainer.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 1fae6d9..f8e57e9 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -2172,6 +2172,14 @@ static bool container_destroy(struct lxc_container *c)
                goto out;
        }
 
+       if (current_config && c->lxc_conf == current_config) {
+               current_config = NULL;
+               if (c->lxc_conf->logfd != -1) {
+                       close(c->lxc_conf->logfd);
+                       c->lxc_conf->logfd = -1;
+               }
+       }
+
        if (c->lxc_conf && c->lxc_conf->rootfs.path && 
c->lxc_conf->rootfs.mount) {
                if (am_unpriv())
                        ret = userns_exec_1(c->lxc_conf, bdev_destroy_wrapper, 
c->lxc_conf);
-- 
2.1.4

_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to