]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/daemon.c
ITS#4550 don't overwrite remote server's err msg
[openldap] / servers / slapd / daemon.c
index 4e93170bc1eb0b5527b300b455df6d92f55c1d54..03559d6288a9742454d5ef0068c8ea5b350f3b56 100644 (file)
@@ -831,7 +831,8 @@ static int slap_get_listener_addresses(
                        sap[i]->sa_family = AF_INET;
                        ((struct sockaddr_in *)sap[i])->sin_port = htons(port);
                        AC_MEMCPY( &((struct sockaddr_in *)sap[i])->sin_addr,
-                               he ? he->h_addr_list[i] : &in, sizeof(struct in_addr) );
+                               he ? (struct in_addr *)he->h_addr_list[i] : &in,
+                               sizeof(struct in_addr) );
                }
                sap[i] = NULL;
 #endif
@@ -2093,7 +2094,7 @@ slapd_daemon_task(
 #endif
 
                for (i=0; i<ns; i++) {
-                       int rc = 1, fd, waswrite = 0;
+                       int rc = 1, fd;
 
                        if ( SLAP_EVENT_IS_LISTENER(i) ) {
 #ifdef SLAP_LIGHTWEIGHT_DISPATCHER
@@ -2123,7 +2124,7 @@ slapd_daemon_task(
                                                "daemon: write active on %d\n",
                                                fd, 0, 0 );
 
-                                       waswrite = 1;
+                                       SLAP_EVENT_CLR_WRITE( i );
 
                                        /*
                                         * NOTE: it is possible that the connection was closed
@@ -2135,12 +2136,13 @@ slapd_daemon_task(
                                                continue;
                                        }
                                }
-                               /* If event is a read or an error */
-                               if( SLAP_EVENT_IS_READ( i ) || !waswrite ) {
+                               /* If event is a read */
+                               if( SLAP_EVENT_IS_READ( i )) {
                                        Debug( LDAP_DEBUG_CONNS,
                                                "daemon: read active on %d\n",
                                                fd, 0, 0 );
 
+                                       SLAP_EVENT_CLR_READ( i );
 #ifdef SLAP_LIGHTWEIGHT_DISPATCHER
                                        connection_read_activate( fd );
 #else
@@ -2152,6 +2154,9 @@ slapd_daemon_task(
                                         */
                                        connection_read( fd );
 #endif
+                               } else {
+                                       Debug( LDAP_DEBUG_CONNS,
+                                               "daemon: hangup on %d\n", fd, 0, 0 );
                                }
                        }
                }