Commit 377d0119 by Christian Brauner Committed by Stéphane Graber

attach: use lxc_preserve_ns()

parent e437b4ba
......@@ -214,7 +214,7 @@ static int lxc_attach_to_ns(pid_t pid, int which)
{
char path[MAXPATHLEN];
/* according to <http://article.gmane.org/gmane.linux.kernel.containers.lxc.devel/1429>,
* 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" };
......@@ -242,8 +242,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment