From 094c8ba814f388dcefee403c4d369005a8d9810f Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Mon, 2 Jul 2018 02:08:08 +0000 Subject: [PATCH] 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 . --- main.c | 3 +++ 1 file changed, 3 insertions(+) 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 */