From: dlezcano Date: Sun, 18 Jan 2009 21:49:56 +0000 (+0000) Subject: Remove nsgroup directory when the container dies X-Git-Tag: lxc_0_6_0~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e2121f525a91cebad996aa8ec67d629985d22ca;p=thirdparty%2Flxc.git Remove nsgroup directory when the container dies From: Daniel Lezcano 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 Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index ebca4917f..6c0b8f961 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -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); }