]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
open_without_symlink: Account when prefix is empty string
authorBogdan Purcareata <bogdan.purcareata@nxp.com>
Fri, 8 Jan 2016 15:38:35 +0000 (15:38 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 28 Jan 2016 10:58:57 +0000 (11:58 +0100)
In the current implementation, the open_without_symlink function
will default to opening the root mount only if the passed rootfs
prefix is null. It doesn't account for the case where this prefix
is passed as an empty string.

Properly handle this second case as well.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/utils.c

index ed8c4c42de09cf3a27948436c92df0f85a405d93..4e96a508204d0d58edc5d61d416626f35a89fc5f 100644 (file)
@@ -1575,7 +1575,7 @@ static int open_without_symlink(const char *target, const char *prefix_skip)
        fulllen = strlen(target);
 
        /* make sure prefix-skip makes sense */
-       if (prefix_skip) {
+       if (prefix_skip && strlen(prefix_skip) > 0) {
                curlen = strlen(prefix_skip);
                if (!is_subdir(target, prefix_skip, curlen)) {
                        ERROR("WHOA there - target '%s' didn't start with prefix '%s'",