]> git.sur5r.net Git - openldap/commitdiff
ITS#4357 Solaris occasionally returns ENOSYS when selecting on a descriptor
authorHoward Chu <hyc@openldap.org>
Fri, 20 Jan 2006 08:13:54 +0000 (08:13 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 20 Jan 2006 08:13:54 +0000 (08:13 +0000)
in the midst of closing. Instead of special casing EBADF, ENOSYS, and
WSAENOTSOCK, just count if any error occurs two or more times in a row,
and log if so. Don't treat any error as fatal unless it occurs many times
in a row (SLAPD_EBADF_LIMIT).

servers/slapd/daemon.c

index 0e9f220b707700048235e79ec516447982c8fff9..85fbf5f3d8053968c63b11376df56223686871bd 100644 (file)
@@ -1840,21 +1840,17 @@ slapd_daemon_task(
                case -1: {      /* failure - try again */
                                int err = sock_errno();
 
-                               if( err == EBADF
-#ifdef WSAENOTSOCK
-                                       /* you'd think this would be EBADF */
-                                       || err == WSAENOTSOCK
-#endif
-                               ) {
-                                       if (++ebadf < SLAPD_EBADF_LIMIT)
-                                               continue;
-                               }
-
                                if( err != EINTR ) {
-                                       Debug( LDAP_DEBUG_ANY,
-                                               "daemon: select failed (%d): %s\n",
-                                               err, sock_errstr(err), 0 );
-                                       slapd_shutdown = 2;
+                                       ebadf++;
+
+                                       /* Don't log unless we got it twice in a row */
+                                       if ( !( ebadf & 1 )) {
+                                               Debug( LDAP_DEBUG_ANY,
+                                                       "daemon: select failed count %d err (%d): %s\n",
+                                                       ebadf, err, sock_errstr(err) );
+                                       }
+                                       if ( ebadf >= SLAPD_EBADF_LIMIT )
+                                               slapd_shutdown = 2;
                                }
                        }
                        continue;