From 424aaa0f9d53aae5a0ed8b33ee7837f0990241de Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Mon, 13 Jan 2025 10:29:47 +0000 Subject: [PATCH] Fix another 509afcd1d2f9edbd1e11c9abd0f335f02baa7fc4 SNAFU --- src/dnsmasq.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/dnsmasq.c b/src/dnsmasq.c index 70ec386..fc35018 100644 --- a/src/dnsmasq.c +++ b/src/dnsmasq.c @@ -1840,8 +1840,7 @@ static void check_dns_listeners(time_t now) struct listener *listener; struct randfd_list *rfl; int i; - int pipefd[2]; - + /* Note that handling events here can create or destroy fds and render the result of the last poll() call invalid. Once we find an fd that needs service, do it, then return to go around the @@ -1925,7 +1924,7 @@ static void do_tcp_connection(struct listener *listener, time_t now, int slot) pid_t p; union mysockaddr tcp_addr; socklen_t tcp_len = sizeof(union mysockaddr); - unsigned char *buff; + unsigned char a = 0, *buff; struct server *s; int flags, auth_dns; struct in_addr netmask; @@ -2039,7 +2038,7 @@ static void do_tcp_connection(struct listener *listener, time_t now, int slot) is sent by the child after it has closed the netlink socket. */ - read_write(pipefd[0], buff, 1, RW_READ); + read_write(pipefd[0], &a, 1, RW_READ); #endif @@ -2080,8 +2079,6 @@ static void do_tcp_connection(struct listener *listener, time_t now, int slot) { #ifdef HAVE_LINUX_NETWORK /* See comment above re: netlink socket. */ - unsigned char a = 0; - close(daemon->netlinkfd); read_write(pipefd[1], &a, 1, RW_WRITE); #endif