From: Christian Brauner Date: Fri, 28 Oct 2016 10:33:30 +0000 (+0200) Subject: attach: use lxc_preserve_ns() X-Git-Tag: lxc-2.1.0~260^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=383613cc36b285253fff6adbca2a79516c3e19e0;p=thirdparty%2Flxc.git attach: use lxc_preserve_ns() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index 99b07fa42..9fe66a8e9 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -222,7 +222,7 @@ static int lxc_attach_to_ns(pid_t pid, int which) { char path[MAXPATHLEN]; /* according to , - * the file for user namepsaces in /proc/$pid/ns will be called + * the file for user namespaces in /proc/$pid/ns will be called * 'user' once the kernel supports it */ static char *ns[] = { "user", "mnt", "pid", "uts", "ipc", "net", "cgroup" }; @@ -250,8 +250,7 @@ static int lxc_attach_to_ns(pid_t pid, int which) continue; } - snprintf(path, MAXPATHLEN, "/proc/%d/ns/%s", pid, ns[i]); - fd[i] = open(path, O_RDONLY | O_CLOEXEC); + fd[i] = lxc_preserve_ns(pid, ns[i]); if (fd[i] < 0) { saved_errno = errno;