author | wenzelm |
Thu, 29 Nov 2012 23:12:50 +0100 | |
changeset 50290 | 735bea8d89c9 |
parent 50289 | 5a1194acbecd |
child 50291 | 674893679352 |
child 50303 | 5c4c35321e87 |
--- a/Admin/exec_process/exec_process.c Thu Nov 29 18:05:41 2012 +0100 +++ b/Admin/exec_process/exec_process.c Thu Nov 29 23:12:50 2012 +0100 @@ -39,8 +39,12 @@ /* setsid */ - if (getgid() == getpid()) fail("Cannot set session id"); - setsid(); + if (setsid() == -1) { + pid_t pid = fork(); + if (pid == -1) fail("Cannot set session id (failed to fork)"); + else if (pid != 0) exit(0); + else if (setsid() == -1) fail("Cannot set session id (after fork)"); + } /* exec */