Skip to content

Commit

Permalink
Catch all real-time signals, decide later which one we handle and whi…
Browse files Browse the repository at this point in the history
…ch one we ignore.

Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Nov 30, 2020
1 parent 5709ce3 commit a8266a7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static void __attribute__((noreturn)) signal_handler(int sig, siginfo_t *si, voi
// Print content of /dev/shm
ls_dir("/dev/shm");


logg("Please also include some lines from above the !!!!!!!!! header.");
logg("Thank you for helping us to improve our FTL engine!");

// Terminate main process if crash happened in a TCP worker
Expand All @@ -246,7 +246,6 @@ static void __attribute__((noreturn)) signal_handler(int sig, siginfo_t *si, voi
exit(EXIT_FAILURE);
}

#define RTSIG_MAX 2
static void SIGRT_handler(int signum, siginfo_t *si, void *unused)
{
// Ignore real-time signals outside of the main process (TCP forks)
Expand Down Expand Up @@ -358,15 +357,15 @@ void handle_realtime_signals(void)
// the main process
mpid = getpid();

// Catch first five real-time signals
for(unsigned char i = 0; i < (RTSIG_MAX+1); i++)
// Catch all real-time signals
for(int signum = SIGRTMIN; signum <= SIGRTMAX; signum++)
{
struct sigaction SIGACTION;
memset(&SIGACTION, 0, sizeof(struct sigaction));
SIGACTION.sa_flags = SA_SIGINFO;
sigemptyset(&SIGACTION.sa_mask);
SIGACTION.sa_sigaction = &SIGRT_handler;
sigaction(SIGRTMIN + i, &SIGACTION, NULL);
sigaction(signum, &SIGACTION, NULL);
}
}

Expand Down

1 comment on commit a8266a7

@pralor-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-core-web-v5-2-1-and-ftl-v5-3-2-released/41148/1

Please sign in to comment.