{
int so_errno;
int dummy = sizeof(so_errno);
- if ( getsockopt( s, SOL_SOCKET, SO_ERROR, &so_errno, &dummy ) == -1 ) {
+ if ( getsockopt( s, SOL_SOCKET, SO_ERROR, &so_errno, &dummy )
+ == SOCKET_ERROR )
+ {
return -1;
}
if ( so_errno ) {
struct sockaddr_in sin;
char ch;
int dummy = sizeof(sin);
- if ( getpeername( s, (struct sockaddr *) &sin, &dummy ) == -1 ) {
+ if ( getpeername( s, (struct sockaddr *) &sin, &dummy )
+ == SOCKET_ERROR )
+ {
/* XXX: needs to be replace with ber_stream_read() */
read(s, &ch, 1);
#ifdef HAVE_WINSOCK
if ( ldap_pvt_ndelay_on(ld, s) == -1 )
return ( -1 );
- if ( connect(s, sin, addrlen) == 0 )
+ if ( connect(s, sin, addrlen) != SOCKET_ERROR )
{
if ( ldap_pvt_ndelay_off(ld, s) == -1 )
return ( -1 );
#else
z,
#endif
- opt_tv ? &tv : NULL) == -1)
+ opt_tv ? &tv : NULL) == SOCKET_ERROR )
+ {
return ( -1 );
+ }
#ifdef HAVE_WINSOCK
/* This means the connection failed */
- if (FD_ISSET(s, &efds))
- {
+ if ( FD_ISSET(s, &efds) ) {
ldap_pvt_set_errno(WSAECONNREFUSED);
osip_debug(ld, "ldap_pvt_connect: error on socket %d: "
"errno: %d (%s)\n", s, errno, sock_errstr(errno));
do {
/* we assume AF_x and PF_x are equal for all x */
s = ldap_int_socket( ld, sai->ai_family, SOCK_STREAM );
- if ( s == -1 ) {
+ if ( s == AC_SOCKET_INVALID ) {
continue;
}
for ( i = 0; !use_hp || (hp->h_addr_list[i] != 0); ++i, rc = -1 ) {
s = ldap_int_socket( ld, PF_INET, SOCK_STREAM );
- if ( s == -1 ) {
+ if ( s == AC_SOCKET_INVALID ) {
/* use_hp ? continue : break; */
break;
}
{
int so_errno;
int dummy = sizeof(so_errno);
- if ( getsockopt( s, SOL_SOCKET, SO_ERROR, &so_errno, &dummy ) == -1 ) {
+ if ( getsockopt( s, SOL_SOCKET, SO_ERROR, &so_errno, &dummy )
+ == SOCKET_ERROR )
+ {
return -1;
}
if ( so_errno ) {
struct sockaddr_un sa;
char ch;
int dummy = sizeof(sa);
- if ( getpeername( s, (struct sockaddr *) &sa, &dummy ) == -1 ) {
+ if ( getpeername( s, (struct sockaddr *) &sa, &dummy )
+ == SOCKET_ERROR )
+ {
/* XXX: needs to be replace with ber_stream_read() */
read(s, &ch, 1);
TRACE;
if ( ldap_pvt_ndelay_on(ld, s) == -1 )
return ( -1 );
- if ( connect(s, (struct sockaddr *) sa, sizeof(struct sockaddr_un)) == 0 )
+ if ( connect(s, (struct sockaddr *) sa, sizeof(struct sockaddr_un))
+ != SOCKET_ERROR )
{
- if ( ldap_pvt_ndelay_off(ld, s) == -1 )
+ if ( ldap_pvt_ndelay_off(ld, s) == -1 ) {
return ( -1 );
+ }
return ( 0 );
}
FD_ZERO(&wfds);
FD_SET(s, &wfds );
- if ( select(ldap_int_tblsize, z, &wfds, z, opt_tv ? &tv : NULL) == -1)
+ if ( select(ldap_int_tblsize, z, &wfds, z, opt_tv ? &tv : NULL)
+ == SOCKET_ERROR )
+ {
return ( -1 );
+ }
if ( FD_ISSET(s, &wfds) ) {
if ( ldap_pvt_is_socket_ready(ld, s) == -1 )
ldap_connect_to_path(LDAP *ld, Sockbuf *sb, const char *path, int async)
{
struct sockaddr_un server;
- ber_socket_t s = AC_SOCKET_INVALID;
+ ber_socket_t s;
int rc;
oslocal_debug(ld, "ldap_connect_to_path\n",0,0,0);
- if ( (s = ldap_pvt_socket( ld )) == -1 ) {
+ s = ldap_pvt_socket( ld );
+ if ( s == AC_SOCKET_INVALID ) {
return -1;
}