Open a new process group before setting up signal handler
When cleaning up after a caught signal, quark forwards the signal to all processes in the process group with `kill(0, ...)`. If we do not open up a new process group in the parent process, quarks parent will be sent a SIG... too, resulting it to shut down (especially considering that the parent process might run as root). As a result, if we set up the service with djb's excellent daemontools, `svc -d quark` will terminate the svscan-process and tear all other services down with it. See also <https://cr.yp.to/daemontools/faq/create.html#pgrphack>.
This commit is contained in:
parent
ba38b0969f
commit
094c8ba814
1 changed files with 3 additions and 0 deletions
3
main.c
3
main.c
|
@ -240,6 +240,9 @@ main(int argc, char *argv[])
|
|||
"Entry not found");
|
||||
}
|
||||
|
||||
/* Open a new process group */
|
||||
setpgid(0,0);
|
||||
|
||||
handlesignals(sigcleanup);
|
||||
|
||||
/* bind socket */
|
||||
|
|
Loading…
Reference in a new issue