[lxc-devel] Howto user namespaces?

richard -rw- weinberger richard.weinberger at gmail.com
Tue Apr 16 11:22:59 UTC 2013


The function below is broken, it does never return if a path looks
like "//foo/bar" and corrupts the thread stack.
HINT: dirname("//") does _not_ return "/".

This is most likely the reason why I saw all the strange things.
Debugging this was not fun because valgrind and gdb were useless because they
do not see the cloned() thread. (Dunno exactly why).

from utils.c:
extern int mkdir_p(char *dir, mode_t mode)
{
        int ret;
        char *d;

        if (!strcmp(dir, "/"))
                return 0;

        d = strdup(dir);
        if (!d)
                return -1;

        ret = mkdir_p(dirname(d), mode);
        free(d);
        if (ret)
                return -1;

        if (!access(dir, F_OK))
                return 0;

        if (mkdir(dir, mode)) {
                SYSERROR("failed to create directory '%s'\n", dir);
                return -1;
        }

        return 0;
}

Thanks,
//richard




More information about the lxc-devel mailing list