Replace deprecated siginterrupt usage with sigaction

This commit is contained in:
Mario Fetka
2026-04-20 23:39:42 +02:00
parent 0ae7503930
commit d17fe40b3d
2 changed files with 29 additions and 10 deletions

View File

@@ -33,6 +33,7 @@
#include "net.h"
#include <string.h>
#include <signal.h>
#include "nwdbm.h"
#include "unxlog.h"
@@ -2091,15 +2092,20 @@ static void sig_handler(int isig)
static void set_sig(void)
{
signal(SIGQUIT, sig_handler);
signal(SIGHUP, sig_handler);
signal(SIGUSR2, sig_handler);
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = sig_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0; /* no SA_RESTART */
sigaction(SIGQUIT, &sa, NULL);
sigaction(SIGHUP, &sa, NULL);
sigaction(SIGUSR2, &sa, NULL);
signal(SIGTERM, SIG_IGN);
signal(SIGINT, SIG_IGN);
signal(SIGPIPE, SIG_IGN);
siginterrupt(SIGQUIT, 1);
siginterrupt(SIGHUP, 1);
siginterrupt(SIGUSR2, 1);
}
int main(int argc, char *argv[])