commit 094c8ba814f388dcefee403c4d369005a8d9810f Author: Dominik Schmidt <domischm...@swissonline.ch> AuthorDate: Mon Jul 2 02:08:08 2018 +0000 Commit: Laslo Hunhold <d...@frign.de> CommitDate: Mon Jul 2 07:14:00 2018 +0200
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>. diff --git a/main.c b/main.c index 7223b24..e9d0a06 100644 --- a/main.c +++ b/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 */