while ( !slapd_shutdown ) {
unsigned int i;
int ns, nfds;
+ int ebadf = 0;
+#define SLAPD_EBADF_LIMIT 10
fd_set readfds;
fd_set writefds;
case -1: { /* failure - try again */
int err = errno;
- if( err != EINTR || err != EBADF) {
+ if( err == EBADF && ++ebadf < SLAPD_EBADF_LIMIT) {
+ continue;
+ }
+
+ if( err != EINTR ) {
Debug( LDAP_DEBUG_CONNS,
"daemon: select failed (%d): %s\n",
err,
continue;
case 0: /* timeout - let threads run */
+ ebadf = 0;
Debug( LDAP_DEBUG_CONNS, "daemon: select timeout - yielding\n",
0, 0, 0 );
ldap_pvt_thread_yield();
continue;
default: /* something happened - deal with it */
+ ebadf = 0;
Debug( LDAP_DEBUG_CONNS, "daemon: activity on %d descriptors\n",
ns, 0, 0 );
/* FALL THRU */