Moved the unsharing of netns into util-vserver-pl
[linux-2.6.git] / enter_admin.c
index 8b02cd2..fdbfe2c 100644 (file)
@@ -1,3 +1,9 @@
+/* enter_admin.c       Vsys script to switch a vserver into admin mode in which it has access 
+ *                     to the Internet. Install in /vsys and invoke as echo $$ > /vsys/enter_admin.in
+ *                     from within the slice.
+ *                     3/21/2008       Sapan Bhatia
+ */
+
 #include <sys/syscall.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -19,7 +25,8 @@ int get_slice_xid(char *slice_name) {
        char slicepath[PATHLEN];
        FILE *fp;
        int xid;
-       snprintf(slicepath, sizeof(slicepath), "/etc/vservers/%s/context");
+       snprintf(slicepath, sizeof(slicepath), "/etc/vservers/%s/context",
+                slice_name);
 
        if ((fp = fopen(slicepath, "r")) == NULL) {
                printf("Could not open %s\n", slicepath);       
@@ -39,7 +46,7 @@ int verify_ownership(int pid, int arg_xid) {
        char procpath[PATHLEN];
        FILE *fp;
        int xid;
-       snprintf(procpath, sizeof(procpath), "/proc/%d/vinfo");
+       snprintf(procpath, sizeof(procpath), "/proc/%d/vinfo", pid);
 
        if ((fp = fopen(procpath, "r")) == NULL) {
                printf("Could not open %s\n", procpath);