From 8f52aa24d3e0737edb1eb6a04e90aa610376cc60 Mon Sep 17 00:00:00 2001 From: David Bender Date: Wed, 19 Dec 2012 02:34:30 -0500 Subject: [PATCH] ITS#7476 Prevent EINTR from stopping otherwise successful connect --- libraries/libldap/os-ip.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index c7dc719a7b..b31e05dc9b 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -438,13 +438,21 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s, if ( opt_tv && ldap_pvt_ndelay_on(ld, s) == -1 ) return ( -1 ); - if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR ) { - if ( opt_tv && ldap_pvt_ndelay_off(ld, s) == -1 ) - return ( -1 ); - return ( 0 ); - } + do{ + osip_debug(ld, "attempting to connect: \n", 0, 0, 0); + if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR ) { + osip_debug(ld, "connect success\n", 0, 0, 0); + + if ( opt_tv && ldap_pvt_ndelay_off(ld, s) == -1 ) + return ( -1 ); + return ( 0 ); + } + err = sock_errno(); + osip_debug(ld, "connect errno: %d\n", err, 0, 0); + + } while(err == EINTR && + LDAP_BOOL_GET( &ld->ld_options, LDAP_BOOL_RESTART )); - err = sock_errno(); if ( err != EINPROGRESS && err != EWOULDBLOCK ) { return ( -1 ); } -- 2.39.5