From 4e2121f525a91cebad996aa8ec67d629985d22ca Mon Sep 17 00:00:00 2001 From: dlezcano Date: Sun, 18 Jan 2009 21:49:56 +0000 Subject: [PATCH] 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 --- src/lxc/cgroup.c | 5 +++++ 1 file changed, 5 insertions(+) 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); } -- 2.47.3