--- ./resolv/res_send.c.orig 2010-01-16 21:18:24.000000000 +0000 +++ ./resolv/res_send.c 2010-01-16 21:22:08.774837358 +0000 @@ -103,13 +103,13 @@ #define MAXPACKET 65536 #endif - +#ifdef SOCK_NONBLOCK #ifndef __ASSUME_SOCK_CLOEXEC static int __have_o_nonblock; #else # define __have_o_nonblock 0 #endif - +#endif /* From ev_streams.c. */ @@ -913,6 +913,7 @@ /* only try IPv6 if IPv6 NS and if not failed before */ if (nsap->sa_family == AF_INET6 && !statp->ipv6_unavail) { +#ifdef SOCK_NONBLOCK if (__builtin_expect (__have_o_nonblock >= 0, 1)) { EXT(statp).nssocks[ns] = socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK, @@ -925,12 +926,14 @@ #endif } if (__builtin_expect (__have_o_nonblock < 0, 0)) +#endif EXT(statp).nssocks[ns] = socket(PF_INET6, SOCK_DGRAM, 0); if (EXT(statp).nssocks[ns] < 0) statp->ipv6_unavail = errno == EAFNOSUPPORT; slen = sizeof (struct sockaddr_in6); } else if (nsap->sa_family == AF_INET) { +#ifdef SOCK_NONBLOCK if (__builtin_expect (__have_o_nonblock >= 0, 1)) { EXT(statp).nssocks[ns] = socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, @@ -943,6 +946,7 @@ #endif } if (__builtin_expect (__have_o_nonblock < 0, 0)) +#endif EXT(statp).nssocks[ns] = socket(PF_INET, SOCK_DGRAM, 0); slen = sizeof (struct sockaddr_in); @@ -969,7 +973,11 @@ __res_iclose(statp, false); return (0); } +#ifdef SOCK_NONBLOCK if (__builtin_expect (__have_o_nonblock < 0, 0)) { +#else + { +#endif /* Make socket non-blocking. */ int fl = __fcntl (EXT(statp).nssocks[ns], F_GETFL); if (fl != -1) --- ./nscd/connections.c.orig 2009-04-30 21:37:18.000000000 +0000 +++ ./nscd/connections.c 2010-01-16 21:19:18.461095060 +0000 @@ -1835,6 +1835,7 @@ /* We have a new incoming connection. Accept the connection. */ int fd; +#ifdef SOCK_NONBLOCK #ifndef __ASSUME_ACCEPT4 fd = -1; if (have_accept4 >= 0) @@ -1851,6 +1852,9 @@ if (have_accept4 < 0) fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL)); #endif +#else + fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL)); +#endif /* Use the descriptor if we have not reached the limit. */ if (fd >= 0) @@ -2040,7 +2044,7 @@ { /* A new connection. */ int fd; - +#ifdef SOCK_NONBLOCK # ifndef __ASSUME_ACCEPT4 fd = -1; if (have_accept4 >= 0) @@ -2057,6 +2061,9 @@ if (have_accept4 < 0) fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL)); # endif +#else + fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL)); +#endif /* Use the descriptor if we have not reached the limit. */ if (fd >= 0)