From: Mark Andrews Date: Mon, 21 May 2007 01:55:10 +0000 (+0000) Subject: 2189. [bug] Handle socket() returning EINTR. [RT #15949] X-Git-Tag: v9.5.0a5~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bb0f1046f3f3c26539ff91e28b3c8872519df17;p=thirdparty%2Fbind9.git 2189. [bug] Handle socket() returning EINTR. [RT #15949] --- diff --git a/CHANGES b/CHANGES index 831ea63ba23..0d06d3d7b6c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +2189. [bug] Handle socket() returning EINTR. [RT #15949] + 2188. [contrib] queryperf: autoconf changes to make the search for libresolv or libbind more robust. [RT #16299] diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 367ce6ef6fe..65955da2fb5 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.271 2007/04/02 02:03:55 marka Exp $ */ +/* $Id: socket.c,v 1.272 2007/05/21 01:55:10 marka Exp $ */ /*! \file */ @@ -1475,6 +1475,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, #endif char strbuf[ISC_STRERRORSIZE]; const char *err = "socket"; + int try = 0; REQUIRE(VALID_MANAGER(manager)); REQUIRE(socketp != NULL && *socketp == NULL); @@ -1484,6 +1485,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, return (result); sock->pf = pf; + again: switch (type) { case isc_sockettype_udp: sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP); @@ -1498,6 +1500,8 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, INSIST(type != isc_sockettype_fdwatch); break; } + if (sock->fd == -1 && errno == EINTR && try++ < 42) + goto again; #ifdef F_DUPFD /*