2189. [bug] Handle socket() returning EINTR. [RT #15949]

This commit is contained in:
Mark Andrews 2007-05-21 01:56:11 +00:00
parent 6930fabc02
commit d5d44a1fed
2 changed files with 7 additions and 1 deletions

View file

@ -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]

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.237.18.27 2007/04/02 02:10:51 marka Exp $ */
/* $Id: socket.c,v 1.237.18.28 2007/05/21 01:56:11 marka Exp $ */
/*! \file */
@ -1451,6 +1451,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);
@ -1460,6 +1461,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);
@ -1471,6 +1473,8 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
sock->fd = socket(pf, SOCK_STREAM, 0);
break;
}
if (sock->fd == -1 && errno == EINTR && try++ < 42)
goto again;
#ifdef F_DUPFD
/*