From d8057e8ffaad5518af96d82e0cbd8da44fb425ea Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 5 Nov 2006 13:05:50 +0100 Subject: [PATCH] dns plugin: Corrected the handling of signals, i. e. don't catch them. --- src/dns.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/dns.c b/src/dns.c index a83f0ac1..b97ce287 100644 --- a/src/dns.c +++ b/src/dns.c @@ -281,6 +281,10 @@ static void dns_child_loop (void) struct pollfd poll_fds[2]; int status; + /* Don't catch these signals */ + signal (SIGINT, SIG_DFL); + signal (SIGTERM, SIG_DFL); + /* Passing `pcap_device == NULL' is okay and the same as passign "any" */ DBG ("Creating PCAP object.."); pcap_obj = pcap_open_live (pcap_device, @@ -334,6 +338,14 @@ static void dns_child_loop (void) DBG ("poll (...)"); status = poll (poll_fds, 2, -1 /* wait forever for a change */); + /* Signals are not caught, but this is very handy when + * attaching to the process with a debugger. -octo */ + if ((status < 0) && (errno == EINTR)) + { + errno = 0; + continue; + } + if (status < 0) { syslog (LOG_ERR, "dns plugin: poll(2) failed: %s", -- 2.11.0