From d2f10912ee4575445a9c630fa93380078127b843 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sun, 18 Feb 2018 23:43:43 +0100 Subject: [PATCH] start: preserve_ns() Signed-off-by: Christian Brauner --- src/lxc/start.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/lxc/start.c b/src/lxc/start.c index 13c420964..0a9dc3a6b 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -141,18 +141,10 @@ static void close_ns(int ns_fd[LXC_NS_MAX]) */ static bool preserve_ns(int ns_fd[LXC_NS_MAX], int clone_flags, pid_t pid) { - int i, ret; + int i; for (i = 0; i < LXC_NS_MAX; i++) - ns_fd[i] = -1; - - ret = lxc_preserve_ns(pid, ""); - if (ret < 0) { - SYSERROR("Kernel does not support attaching to namespaces."); - return false; - } else { - close(ret); - } + ns_fd[i] = -EBADF; for (i = 0; i < LXC_NS_MAX; i++) { if ((clone_flags & ns_info[i].clone_flag) == 0) @@ -166,9 +158,11 @@ static bool preserve_ns(int ns_fd[LXC_NS_MAX], int clone_flags, pid_t pid) error: if (errno == ENOENT) - SYSERROR("Kernel does not support attaching to %s namespaces.", ns_info[i].proc_name); + SYSERROR("Kernel does not support attaching to %s namespaces", + ns_info[i].proc_name); else - SYSERROR("Failed to open file descriptor for %s namespace: %s.", ns_info[i].proc_name, strerror(errno)); + SYSERROR("Failed to open file descriptor for %s namespace", + ns_info[i].proc_name); close_ns(ns_fd); return false; } -- 2.47.2