[lxc-devel] [lxc/master] start: don't close inherited namespace fds

brauner on Github lxc-bot at linuxcontainers.org
Thu Sep 28 14:27:16 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 448 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170928/d1d10ec5/attachment.bin>
-------------- next part --------------
From 3659cba9d7b1fd61fa62d890c0fb952d10381e07 Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68 at huawei.com>
Date: Fri, 29 Sep 2017 00:23:30 +0800
Subject: [PATCH] start: don't close inherited namespace fds

Otherwise we can never share namespaces.

Signed-off-by: LiFeng <lifeng68 at huawei.com>
Acked-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/start.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index 3baed693a..33b30cb52 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -236,6 +236,15 @@ int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
 		    (i < len_fds && fd == fds_to_ignore[i]))
 			continue;
 
+		if (conf) {
+			for (i = 0; i < LXC_NS_MAX; i++)
+				if (conf->inherit_ns_fd[i] == fd)
+					break;
+
+			if (i < LXC_NS_MAX)
+				continue;
+		}
+
 		if (current_config && fd == current_config->logfd)
 			continue;
 


More information about the lxc-devel mailing list