From e0bec3342b39097301c331dca68b8f5605ae2e77 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Mon, 30 Mar 2026 20:23:56 +0100 Subject: [PATCH] Move logging on TCP timeout from child process to main process. Callong my_syslog from a signal handler is not good. Thanks to Dominik Derigs for spotting this. --- src/cache.c | 3 +++ src/dnsmasq.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cache.c b/src/cache.c index 5878e4b..b0743f6 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1083,6 +1083,9 @@ int cache_recv_insert(time_t now, int fd) !read_write(fd, (unsigned char *)&validatecount, sizeof(validatecount), RW_READ) || !read_write(fd, (unsigned char *)&validatecountp, sizeof(validatecountp), RW_READ))) return 0; + + if (op == PIPE_OP_KILLED) + my_syslog(LOG_INFO, _("TCP process for DNSSEC validation timed out")); /* There's a tiny chance that the frec may have been freed and reused before the TCP process returns. Detect that with diff --git a/src/dnsmasq.c b/src/dnsmasq.c index 8fcbbda..16d0a71 100644 --- a/src/dnsmasq.c +++ b/src/dnsmasq.c @@ -1385,8 +1385,6 @@ static void sig_handler(int sig) read_write(daemon->pipe_to_parent, (unsigned char *)(&daemon->forward_to_tcp), sizeof(daemon->forward_to_tcp), RW_WRITE); read_write(daemon->pipe_to_parent, (unsigned char *)(&daemon->forward_to_tcp->uid), sizeof(daemon->forward_to_tcp->uid), RW_WRITE); - my_syslog(LOG_INFO, _("TCP process for DNSSEC validation timed out")); - _exit(0); } }