From: bert hubert Date: Mon, 16 Dec 2013 12:19:52 +0000 (+0100) Subject: ok, so it turns out that poll, select and a few other system calls can return EINTR... X-Git-Tag: auth-3.3.1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5dde2c6c91a66846e667e4403f41ee84e53af634;p=thirdparty%2Fpdns.git ok, so it turns out that poll, select and a few other system calls can return EINTR when we receive and interrupt, and we need to manually restart. man 7 signal makes for good reading on this case, as does http://blog.reverberate.org/2011/04/eintr-and-pc-loser-ing-is-better-case.html --- diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index 3efe3ca7c2..aaa7c56a23 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -383,9 +383,14 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled) pfd.revents = 0; } + retry:; + err = poll(&rfds[0], rfds.size(), -1); - if(err < 0) + if(err < 0) { + if(errno==EINTR) + goto retry; unixDie("Unable to poll for new UDP events"); + } BOOST_FOREACH(struct pollfd &pfd, rfds) { if(pfd.revents & POLLIN) {