Commit d3b90403 by Daniel Lezcano Committed by Daniel Lezcano

fix setns parameter

The setns syscall is now mainstream but the parameter passing changed. Let's fix that. The pid namespace and mount namespace attach are missing for the moment. Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent c797dcc3
...@@ -43,13 +43,13 @@ struct clone_arg { ...@@ -43,13 +43,13 @@ struct clone_arg {
void *arg; void *arg;
}; };
int setns(int nstype, int fd) int setns(int fd, int nstype)
{ {
#ifndef __NR_setns #ifndef __NR_setns
errno = ENOSYS; errno = ENOSYS;
return -1; return -1;
#else #else
return syscall(__NR_setns, nstype, fd); return syscall(__NR_setns, fd, nstype);
#endif #endif
} }
...@@ -106,7 +106,7 @@ int lxc_attach(pid_t pid) ...@@ -106,7 +106,7 @@ int lxc_attach(pid_t pid)
} }
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
if (setns(0, fd[i])) { if (setns(fd[i], 0)) {
SYSERROR("failed to set namespace '%s'", ns[i]); SYSERROR("failed to set namespace '%s'", ns[i]);
return -1; return -1;
} }
......
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