[lxc-devel] [lxc/stable-1.1] ['DO NOT MERGE] 2016 05 07/trace stable error

brauner on Github lxc-bot at linuxcontainers.org
Fri May 6 22:43:14 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 352 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160506/bcc5cf33/attachment.bin>
-------------- next part --------------
From 5826f565131dd7afb14d9b8b447cb04c9522d1c6 Mon Sep 17 00:00:00 2001
From: Bogdan Purcareata <bogdan.purcareata at nxp.com>
Date: Fri, 8 Jan 2016 15:38:35 +0000
Subject: [PATCH] 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 <bogdan.purcareata at nxp.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index dac6418..db6e4c8 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -1576,7 +1576,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'",


More information about the lxc-devel mailing list