case LDAP_OPT_TIMEOUT:
/* the caller has to free outvalue ! */
- if ( ldap_int_timeval_dup( outvalue, lo->ldo_tm_api) != 0 )
- {
+ if ( ldap_int_timeval_dup( outvalue, lo->ldo_tm_api) != 0 ) {
return LDAP_OPT_ERROR;
}
return LDAP_OPT_SUCCESS;
case LDAP_OPT_NETWORK_TIMEOUT:
/* the caller has to free outvalue ! */
- if ( ldap_int_timeval_dup( outvalue, lo->ldo_tm_net ) != 0 )
- {
+ if ( ldap_int_timeval_dup( outvalue, lo->ldo_tm_net ) != 0 ) {
return LDAP_OPT_ERROR;
}
return LDAP_OPT_SUCCESS;
struct sockaddr *sin, socklen_t addrlen,
int async)
{
+ int rc;
struct timeval tv, *opt_tv=NULL;
fd_set wfds, *z=NULL;
#ifdef HAVE_WINSOCK
if ( ldap_pvt_ndelay_on(ld, s) == -1 )
return ( -1 );
- if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR )
- {
+ if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR ) {
if ( ldap_pvt_ndelay_off(ld, s) == -1 )
return ( -1 );
return ( 0 );
FD_SET(s, &efds );
#endif
- if ( select(ldap_int_tblsize, z, &wfds,
+ do {
+ rc = select(ldap_int_tblsize, z, &wfds,
#ifdef HAVE_WINSOCK
- &efds,
+ &efds,
#else
- z,
+ z,
#endif
- opt_tv ? &tv : NULL) == AC_SOCKET_ERROR )
- {
- return ( -1 );
- }
+ opt_tv ? &tv : NULL);
+ } while( rc == AC_SOCKET_ERROR && errno == EINTR &&
+ LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART ));
+
+ if( rc == AC_SOCKET_ERROR ) return rc;
#ifdef HAVE_WINSOCK
/* This means the connection failed */
static int
ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_un *sa, int async)
{
+ int rc;
struct timeval tv, *opt_tv=NULL;
fd_set wfds, *z=NULL;
FD_ZERO(&wfds);
FD_SET(s, &wfds );
- if ( select(ldap_int_tblsize, z, &wfds, z, opt_tv ? &tv : NULL)
- == AC_SOCKET_ERROR )
- {
- return ( -1 );
- }
+ do {
+ rc = select(ldap_int_tblsize, z, &wfds, z, opt_tv ? &tv : NULL);
+ } while( rc == AC_SOCKET_ERROR && errno == EINTR &&
+ LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART ));
+
+ if( rc == AC_SOCKET_ERROR ) return rc;
if ( FD_ISSET(s, &wfds) ) {
if ( ldap_pvt_is_socket_ready(ld, s) == -1 )