access dereferences symbolic links. Use lstat instead.
[util-vserver.git] / src / vnamespace.c
index 628dbe2..d840fbb 100644 (file)
@@ -88,7 +88,7 @@ showVersion()
 }
 
 static void
-newNamespace(char const *cmd)
+newNamespace(void)
 {
   pid_t                pid;
 
@@ -107,23 +107,23 @@ newNamespace(char const *cmd)
     case 0     :
       break;
     default    :
-      exitLikeProcess(pid, cmd, wrapper_exit_code);
+      vc_exitLikeProcess(pid, wrapper_exit_code);
   }
 }
 
 static void
-enterNamespace(xid_t xid)
+enterNamespace(xid_t xid, uint_least64_t mask)
 {
-  if (vc_enter_namespace(xid)==-1) {
+  if (vc_enter_namespace(xid, mask)==-1) {
     perror("vnamespace: vc_enter_namespace()");
     exit(255);
   }
 }
 
 static void
-setNamespace()
+setNamespace(xid_t xid, uint_least64_t mask)
 {
-  if (vc_set_namespace()==-1) {
+  if (vc_set_namespace(xid, mask)==-1) {
     perror("vnamespace: vc_set_namespace()");
     exit(255);
   }
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
       default          :
        WRITE_MSG(2, "Try '");
        WRITE_STR(2, argv[0]);
-       WRITE_MSG(2, " --help\" for more information.\n");
+       WRITE_MSG(2, " --help' for more information.\n");
        return 255;
        break;
     }
@@ -181,10 +181,10 @@ int main(int argc, char *argv[])
   else if (optind==argc && (do_new || do_enter))
     WRITE_MSG(2, "No command specified; try '--help' for more information\n");
   else {
-    if      (do_new)     newNamespace(argv[optind]);
-    else if (do_set)     setNamespace();
+    if      (do_new)     newNamespace();
+    else if (do_set)     setNamespace(VC_SAMECTX, CLONE_NEWNS|CLONE_FS);
     else if (do_cleanup) cleanupNamespace();
-    else if (do_enter)   enterNamespace(xid);
+    else if (do_enter)   enterNamespace(xid, CLONE_NEWNS|CLONE_FS);
 
     if (optind<argc)
       EexecvpD(argv[optind], argv+optind);