Commit 2b4e286d by Michel Normand Committed by Daniel Lezcano

the lxc_unlink_nsgroup may fail on ppc. V2

the lxc_unlink_nsgroup may fail on ppc where the stack is not zeroed by default and because the readlink function do not add trailing null character. Signed-off-by: 's avatarMichel Normand <normand@fr.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 47ad75f8
......@@ -114,11 +114,15 @@ int lxc_unlink_nsgroup(const char *name)
{
char nsgroup[MAXPATHLEN];
char path[MAXPATHLEN];
ssize_t len;
snprintf(nsgroup, MAXPATHLEN, LXCPATH "/%s/nsgroup", name);
if (readlink(nsgroup, path, MAXPATHLEN) > 0)
len = readlink(nsgroup, path, MAXPATHLEN-1);
if (len > 0) {
path[len] = '\0';
rmdir(path);
}
return unlink(nsgroup);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment