--- //depot/yahoo/ybsd_6/src/lib/libc/resolv/res_send.c +++ /home/jhb/work/y/p4/ybsd_6/src/lib/libc/resolv/res_send.c @@ -128,10 +128,8 @@ #define EXT(res) ((res)->_u._ext) -#ifndef USE_POLL +#if !defined(USE_POLL) && !defined(USE_KQUEUE) static const int highestFD = FD_SETSIZE - 1; -#else -static int highestFD = 0; #endif /* Forward. */ @@ -309,10 +307,6 @@ #endif char abuf[NI_MAXHOST]; -#ifdef USE_POLL - highestFD = sysconf(_SC_OPEN_MAX) - 1; -#endif - /* No name servers or res_init() failure */ if (statp->nscount == 0 || EXT(statp).ext == NULL) { errno = ESRCH; @@ -663,10 +657,12 @@ res_nclose(statp); statp->_vcsock = _socket(nsap->sa_family, SOCK_STREAM, 0); +#if !defined(USE_POLL) && !defined(USE_KQUEUE) if (statp->_vcsock > highestFD) { res_nclose(statp); errno = ENOTSOCK; } +#endif if (statp->_vcsock < 0) { switch (errno) { case EPROTONOSUPPORT: @@ -841,10 +837,12 @@ if (EXT(statp).nssocks[ns] == -1) { EXT(statp).nssocks[ns] = _socket(nsap->sa_family, SOCK_DGRAM, 0); +#if !defined(USE_POLL) && !defined(USE_KQUEUE) if (EXT(statp).nssocks[ns] > highestFD) { res_nclose(statp); errno = ENOTSOCK; } +#endif if (EXT(statp).nssocks[ns] < 0) { switch (errno) { case EPROTONOSUPPORT: