[lxc-devel] [lxc/master] Fix lxc_inherit_namespace function error

lifeng68 on Github lxc-bot at linuxcontainers.org
Mon Nov 20 03:20:39 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 630 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171120/7376a11d/attachment.bin>
-------------- next part --------------
From 716495668b9fc02fabee48fe2a24c70b88a8226b Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68 at huawei.com>
Date: Mon, 20 Nov 2017 06:42:30 -0500
Subject: [PATCH] Fix namespace config parse error

Signed-off-by: LiFeng <lifeng68 at huawei.com>
---
 src/lxc/confile_utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/confile_utils.c b/src/lxc/confile_utils.c
index 3d843ba77..d86a2d88e 100644
--- a/src/lxc/confile_utils.c
+++ b/src/lxc/confile_utils.c
@@ -759,8 +759,8 @@ int lxc_inherit_namespace(const char *lxcname_or_pid, const char *lxcpath,
 		if (!dup)
 			return -ENOMEM;
 
-		*lastslash = '\0';
-		pid = lxc_container_name_to_pid(lastslash, dup);
+		dup[lastslash - lxcname_or_pid] = '\0';
+		pid = lxc_container_name_to_pid(lastslash + 1, dup);
 		free(dup);
 	} else {
 		pid = lxc_container_name_to_pid(lxcname_or_pid, lxcpath);


More information about the lxc-devel mailing list