]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Remove nsgroup directory when the container dies
authordlezcano <dlezcano>
Sun, 18 Jan 2009 21:49:56 +0000 (21:49 +0000)
committerdlezcano <dlezcano>
Sun, 18 Jan 2009 21:49:56 +0000 (21:49 +0000)
From: Daniel Lezcano <daniel.lezcano@free.fr>

Remove the nsgroup directory when the container dies, otherwise this will
lead to an error when the pids number are recycled

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/cgroup.c

index ebca4917f7840fc07013753bcead608b744ba7af..6c0b8f9610e9a53ba0ab646ace127c1c7910a0e4 100644 (file)
@@ -92,8 +92,13 @@ int lxc_link_nsgroup(const char *name, pid_t pid)
 int lxc_unlink_nsgroup(const char *name)
 {
        char nsgroup[MAXPATHLEN];
+       char path[MAXPATHLEN];
 
        snprintf(nsgroup, MAXPATHLEN, LXCPATH "/%s/nsgroup", name);
+       
+       if (readlink(nsgroup, path, MAXPATHLEN) >  0)
+               rmdir(path);
+
        return unlink(nsgroup);
 }