Use pipe to main process instead of printing directly from the signal handler to avoid futex wait blocking

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-07-31 18:57:15 +02:00
parent e942301897
commit 4c4489a539
2 changed files with 13 additions and 1 deletions
+10 -1
View File
@@ -1310,7 +1310,10 @@ int main_dnsmasq (int argc, char **argv)
static void sig_handler(int sig)
{
log_debug(DEBUG_ANY, "dnsmasq received signal %d", sig);
/**** Pi-hole modification ****/
send_event(pipewrite, EVENT_SIGNAL, sig, NULL);
/******************************/
if (pid == 0)
{
/* ignore anything other than TERM during startup
@@ -1570,6 +1573,12 @@ static void async_event(int pipe, time_t now)
my_syslog(LOG_WARNING, _("script process exited with status %d"), ev.data);
break;
/**** Pi-hole modification ****/
case EVENT_SIGNAL:
log_debug(DEBUG_ANY, "dnsmasq received signal %d", ev.data);
break;
/**************************** */
case EVENT_EXEC_ERR:
my_syslog(LOG_ERR, _("failed to execute %s: %s"),
daemon->lease_change_command, strerror(ev.data));
+3
View File
@@ -200,6 +200,9 @@ struct event_desc {
#define EVENT_SCRIPT_LOG 25
#define EVENT_TIME 26
// Pi-hole
#define EVENT_SIGNAL 255
/* Exit codes. */
#define EC_GOOD 0
#define EC_BADCONF 1