If a SIGHUP/SIGUSR2 is sent immediately after a SIGTERM/SIGINT and
before wait() is notified, it will mask it since there's no queue,
only a copy of the last received signal. Let's add a special check
before overwriting the signal so that SIGTERM/SIGINT are not masked.
static void signal_handler(int signum)
{
- caught_signal = signum;
+ if (caught_signal != SIGINT && caught_signal != SIGTERM)
+ caught_signal = signum;
}
/* handles SIGUSR2 and SIGHUP only */