From: Florian Forster Date: Sun, 5 Nov 2006 12:05:50 +0000 (+0100) Subject: dns plugin: Corrected the handling of signals, i. e. don't catch them. X-Git-Tag: collectd-3.11.0~42^2~1 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d8057e8ffaad5518af96d82e0cbd8da44fb425ea;p=collectd.git dns plugin: Corrected the handling of signals, i. e. don't catch them. --- 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",