Create a new session before running rc-script.
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Sat, 5 Mar 2011 13:45:42 +0000 (13:45 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Sat, 5 Mar 2011 13:45:42 +0000 (13:45 +0000)
This fixes the problem of killall5 not killing stray processes because
they are in the same session as the shell, if both vserver <guest>
start and vserver <guest> stop are run from the same session.

git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2939 94cd875c-1c1d-0410-91d2-eb244daf1a30

src/vcontext.c

index 1ec45a8..1e23637 100644 (file)
@@ -368,6 +368,10 @@ doit(struct Arguments const *args, int argc, char *argv[])
     doExternalSync(ext_sync_fd, args->sync_msg);
     doSyncStage1(p, args->do_disconnect);
     DPRINTF("doit: pid=%u, ppid=%u\n", getpid(), getppid());
+
+    if (args->do_migrateself)
+      setsid();
+
     if (!args->do_vlogin)
       execvp (argv[optind],argv+optind);
     else