blob: 28f9889b5fbef1695ce3cadf5e18372488ecf41c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
From 01074e5b34719537cef474c6b81d4f55e6427639 Mon Sep 17 00:00:00 2001
From: Bogdan Purcareata <bogdan.purcareata@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.
Upstream-Status: Accepted
[https://github.com/lxc/lxc/commit/01074e5b34719537cef474c6b81d4f55e6427639]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Acked-by: Serge E. Hallyn <serge.hallyn@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 ed8c4c4..4e96a50 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -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'",
--
1.9.1
|