]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/os-ip.c
ITS#837: fix server down abandon bug
[openldap] / libraries / libldap / os-ip.c
index 01c6d62f5615b98687c25baa6467f3aca477f7fd..71dcd4be25eed76f07eef7a69ba208f696be03e5 100644 (file)
@@ -115,7 +115,7 @@ ldap_int_prepare_socket(LDAP *ld, int s, int proto )
        osip_debug(ld, "ldap_prepare_socket: %d\n", s,0,0);
 
 #ifdef TCP_NODELAY
-       if( proto = LDAP_PROTO_TCP ) {
+       if( proto == LDAP_PROTO_TCP ) {
                int dummy = 1;
                if ( setsockopt( s, IPPROTO_TCP, TCP_NODELAY,
                        (char*) &dummy, sizeof(dummy) ) == AC_SOCKET_ERROR )
@@ -284,11 +284,9 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
        unsigned long address, int port, int async)
 {
        struct sockaddr_in      sin;
-       struct in_addr          in;
        ber_socket_t            s = AC_SOCKET_INVALID;
        int                     rc, i, use_hp = 0;
-       struct hostent          *hp, he_buf;
-       int                     local_h_errno;
+       struct hostent          *hp = NULL;
        char                    *ha_buf=NULL, *p, *q;
 
        osip_debug(ld, "ldap_connect_to_host\n",0,0,0);
@@ -352,7 +350,10 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
                freeaddrinfo(res);
                return rc;
 #else
+               struct in_addr in;
                if (! inet_aton( host, &in) ) {
+                       int local_h_errno;
+                       struct hostent he_buf;
                        rc = ldap_pvt_gethostbyname_a(host, &he_buf, &ha_buf,
                                        &hp, &local_h_errno);