version 0.30.190
[util-vserver.git] / util-vserver / src / vnamespace.c
index fe90030..fc1cfb5 100644 (file)
@@ -33,6 +33,7 @@
 
 #define ENSC_WRAPPERS_PREFIX   "vnamespace: "
 #define ENSC_WRAPPERS_UNISTD   1
+#define ENSC_WRAPPERS_VSERVER  1
 #include <wrappers.h>
 
 #ifndef CLONE_NEWNS
@@ -91,9 +92,12 @@ showVersion()
 }
 
 static void
-newNamespace()
+newNamespace(char const *cmd)
 {
   pid_t                pid;
+
+  signal(SIGCHLD, SIG_DFL);
+  
 #ifdef NDEBUG    
   pid = sys_clone(CLONE_NEWNS|CLONE_VFORK|SIGCHLD, 0);
 #else
@@ -107,7 +111,7 @@ newNamespace()
     case 0     :
       break;
     default    :
-      exitLikeProcess(pid);
+      exitLikeProcess(pid, cmd, wrapper_exit_code);
   }
 }
 
@@ -157,7 +161,10 @@ int main(int argc, char *argv[])
       case 'n'         :  do_new     = true; break;
       case 's'         :  do_set     = true; break;
       case 'c'         :  do_cleanup = true; break;
-      case 'e'         :  do_enter   = true; xid = atol(optarg); break;
+      case 'e'         :
+       do_enter = true;
+       xid      = Evc_xidopt2xid(optarg,true);
+       break;
 
       default          :
        WRITE_MSG(2, "Try '");
@@ -178,7 +185,7 @@ 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();
+    if      (do_new)     newNamespace(argv[optind]);
     else if (do_set)     setNamespace();
     else if (do_cleanup) cleanupNamespace();
     else if (do_enter)   enterNamespace(xid);