From: Christian Brauner Date: Sun, 18 Feb 2018 22:43:43 +0000 (+0100) Subject: start: preserve_ns() X-Git-Tag: lxc-2.0.10~260 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2f10912ee4575445a9c630fa93380078127b843;p=thirdparty%2Flxc.git start: preserve_ns() Signed-off-by: Christian Brauner --- 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; }