Fixed pid ns bug
authorSapan Bhatia <gwsapan@gmail.com>
Mon, 1 Jul 2013 22:01:32 +0000 (18:01 -0400)
committerSapan Bhatia <gwsapan@gmail.com>
Mon, 1 Jul 2013 22:01:32 +0000 (18:01 -0400)
lxcsu-internal
setns.c

index a670d62..bb7c2a4 100755 (executable)
@@ -142,6 +142,9 @@ def main ():
 
     setns.chcontext('/proc/%s/ns/uts'%pid)
     setns.chcontext('/proc/%s/ns/ipc'%pid)
+    
+    if (not args.pidns):
+        setns.chcontext('/proc/%s/ns/pid'%pid)
 
     if (not args.netns):
         setns.chcontext('/proc/%s/ns/net'%pid)
@@ -149,8 +152,7 @@ def main ():
     if (not args.mntns):
         setns.chcontext('/proc/%s/ns/mnt'%pid)
 
-    if (not args.pidns):
-        setns.chcontext('/proc/%s/ns/pid'%pid)
+    
 
     proc_mounted = False
     if (not os.access('/proc/self',0)):
diff --git a/setns.c b/setns.c
index 7d82d53..971665a 100644 (file)
--- a/setns.c
+++ b/setns.c
@@ -15,12 +15,11 @@ chfscontext(PyObject *self, PyObject *args)
 
     int fd = open(filepath, O_RDONLY);
     if (fd < 0) {
-           //printf("Could not open ns file\n");
         sts = -1;
         goto out;
     }
     
-    if (setns(fd, 666)) {
+    if (setns(fd, 0)) {
         sts = -1;
     }
     close(fd);
@@ -59,7 +58,6 @@ chcontext(PyObject *self, PyObject *args)
 
     int fd = open(filepath, O_RDONLY);
     if (fd < 0) {
-//     printf("Could not open ns file\n");
         sts = -1;
         goto out;
     }