From: Bogdan Purcareata Date: Fri, 8 Jan 2016 15:38:35 +0000 (+0000) Subject: open_without_symlink: Account when prefix is empty string X-Git-Tag: lxc-1.0.9~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ee0980d49b5c16a86c11a2a653140fa16a4a099;p=thirdparty%2Flxc.git open_without_symlink: Account when prefix is empty string 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 Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 214c5a8c9..3d4d6ad06 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -1267,7 +1267,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'",