X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fos-local.c;h=7f1f83100261afd615a09b55dfbbef5efad50abe;hb=d9a60db75ea1dbbc06d90d15e6f6969d8c075ee7;hp=6f798a71fa1f20e2c0aeafc25171fa6e1360983b;hpb=13cbd433bd3659c8c765b03a1aadc445a6861b78;p=openldap diff --git a/libraries/libldap/os-local.c b/libraries/libldap/os-local.c index 6f798a71fa..7f1f831002 100644 --- a/libraries/libldap/os-local.c +++ b/libraries/libldap/os-local.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2009 The OpenLDAP Foundation. + * Copyright 1998-2011 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -328,11 +328,6 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv, int async) oslocal_debug(ld, "ldap_connect_to_path\n",0,0,0); - s = ldap_pvt_socket( ld ); - if ( s == AC_SOCKET_INVALID ) { - return -1; - } - if ( path == NULL || path[0] == '\0' ) { path = LDAPI_SOCK; } else { @@ -342,6 +337,11 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv, int async) } } + s = ldap_pvt_socket( ld ); + if ( s == AC_SOCKET_INVALID ) { + return -1; + } + oslocal_debug(ld, "ldap_connect_to_path: Trying %s\n", path, 0, 0); memset( &server, '\0', sizeof(server) ); @@ -351,10 +351,7 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv, int async) rc = ldap_pvt_connect(ld, s, &server, async); if (rc == 0) { - int err; - err = ldap_int_connect_cbs( ld, sb, &s, srv, (struct sockaddr *)&server ); - if ( err ) - rc = err; + rc = ldap_int_connect_cbs( ld, sb, &s, srv, (struct sockaddr *)&server ); } if ( rc ) { ldap_pvt_close_socket(ld, s);