]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix setns parameter
authorDaniel Lezcano <daniel.lezcano@free.fr>
Thu, 11 Aug 2011 16:59:44 +0000 (18:59 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 11 Aug 2011 16:59:44 +0000 (18:59 +0200)
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: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/namespace.c

index 8263fe79a41dfe40a0b1b6bc157aec75eba81d94..aca29d4f87aa37c4133fe98f38c1b3296b153e66 100644 (file)
@@ -43,13 +43,13 @@ struct clone_arg {
        void *arg;
 };
 
-int setns(int nstype, int fd)
+int setns(int fd, int nstype)
 {
 #ifndef __NR_setns
        errno = ENOSYS;
        return -1;
 #else
-       return syscall(__NR_setns, nstype, fd);
+       return syscall(__NR_setns, fd, nstype);
 #endif
 }
 
@@ -106,7 +106,7 @@ int lxc_attach(pid_t pid)
        }
 
        for (i = 0; i < size; i++) {
-               if (setns(0, fd[i])) {
+               if (setns(fd[i], 0)) {
                        SYSERROR("failed to set namespace '%s'", ns[i]);
                        return -1;
                }