[lxc-devel] [lxc/master] namespaces: allow a pathname to a nsfd for namespace to share

hallyn on Github lxc-bot at linuxcontainers.org
Thu May 2 01:38:23 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 529 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190501/79e8e037/attachment.bin>
-------------- next part --------------
From 080ddd313252382175440a1c9255ddd5275ddd8a Mon Sep 17 00:00:00 2001
From: Serge Hallyn <shallyn at cisco.com>
Date: Wed, 1 May 2019 18:17:23 -0700
Subject: [PATCH] namespaces: allow a pathname to a nsfd for namespace to share

Signed-off-by: Serge Hallyn <shallyn at cisco.com>
---
 src/lxc/confile_utils.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lxc/confile_utils.c b/src/lxc/confile_utils.c
index 5bceb96bdc..d405283836 100644
--- a/src/lxc/confile_utils.c
+++ b/src/lxc/confile_utils.c
@@ -865,6 +865,10 @@ int lxc_inherit_namespace(const char *lxcname_or_pid, const char *lxcpath,
 	int fd, pid;
 	char *dup, *lastslash;
 
+	if (lxcname_or_pid[0] == '/') {
+		return open(lxcname_or_pid, O_RDONLY | O_CLOEXEC);
+	}
+
 	lastslash = strrchr(lxcname_or_pid, '/');
 	if (lastslash) {
 		dup = strdup(lxcname_or_pid);


More information about the lxc-devel mailing list