]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
utils: allow a repeated signal
authorDavid Vašek <david.vasek@nic.cz>
Fri, 25 Aug 2023 10:49:04 +0000 (12:49 +0200)
committerDavid Vašek <david.vasek@nic.cz>
Fri, 25 Aug 2023 12:50:32 +0000 (14:50 +0200)
It can help when the running handler gets stuck and the user needs to terminate the utility anyway.

src/utils/common/signal.c

index df95ba7945d92cdae9238d57ddf4c77ead48c427..b46e40d8eb5ab4efaffa056d438c73a93602f5dd 100644 (file)
@@ -26,6 +26,12 @@ int SIGNAL_REPEAT = 1;
 
 static void signal_handler(int signum)
 {
+       // Allow a repeated signal during the handler run (in case
+       // the handler gets stuck).
+       sigset_t set;
+       (void)sigaddset(&set, signum);
+       (void)sigprocmask(SIG_UNBLOCK, &set, NULL);
+
        if (--SIGNAL_REPEAT < 0) {
                abort();
        }