--- CVS-latest/lib/ldap.c Thu May 06 09:22:32 2004 +++ lib/ldap.c Thu May 06 13:00:46 2004 @@ -105,7 +105,9 @@ /*********************************************************************** */ static void *libldap = NULL; +#ifndef WIN32 static void *liblber = NULL; +#endif static int DynaOpen(const char **mod_name) { @@ -501,7 +503,7 @@ return LDAP_NO_MEMORY; p = strchr(ludp->lud_dn, '?'); - LDAP_TRACE (("DN '%.*s'\n", p ? (p-ludp->lud_dn) : strlen(ludp->lud_dn), + LDAP_TRACE (("DN '%.*s'\n", p ? (size_t)(p-ludp->lud_dn) : strlen(ludp->lud_dn), ludp->lud_dn)); if (!p) --- CVS-latest/lib/ldap.h Wed Jan 07 11:19:35 2004 +++ lib/ldap.h Thu May 06 13:34:25 2004 @@ -25,6 +25,5 @@ ***************************************************************************/ #ifndef CURL_DISABLE_LDAP CURLcode Curl_ldap(struct connectdata *conn); -CURLcode Curl_ldap_done(struct connectdata *conn); #endif #endif /* __LDAP_H */ --- CVS-latest/lib/connect.c Tue Apr 27 15:56:23 2004 +++ lib/connect.c Fri May 07 22:49:45 2004 @@ -102,7 +102,7 @@ #include "memdebug.h" #endif -static bool verifyconnect(curl_socket_t sockfd); +static bool verifyconnect(curl_socket_t sockfd, int *error); /* * Curl_ourerrno() returns the errno (or equivalent) on this platform to @@ -204,7 +204,7 @@ /* Call this function once now, and ignore the results. We do this to "clear" the error state on the socket so that we can later read it reliably. This is reported necessary on the MPE/iX operating system. */ - verifyconnect(sockfd); + verifyconnect(sockfd, NULL); #endif /* now select() until we get connect or timeout */ @@ -398,23 +398,31 @@ /* * verifyconnect() returns TRUE if the connect really has happened. */ -static bool verifyconnect(curl_socket_t sockfd) +static bool verifyconnect(curl_socket_t sockfd, int *error) { -#if defined(SO_ERROR) && !defined(WIN32) +#if defined(SO_ERROR) int err = 0; + bool rc; socklen_t errSize = sizeof(err); if( -1 == getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize)) err = Curl_ourerrno(); - if ((0 == err) || (EISCONN == err)) + if ((0 == err) || (EISCONN == err)) { /* we are connected, awesome! */ - return TRUE; - + rc = TRUE; + } + else { /* This wasn't a successful connect */ - return FALSE; + rc = FALSE; + } + if (error) + *error = err; + return rc; #else (void)sockfd; + if (error) + *error = Curl_ourerrno(); return TRUE; #endif } @@ -467,7 +475,7 @@ rc = waitconnect(sockfd, 0); if(0 == rc) { - if (verifyconnect(sockfd)) { + if (verifyconnect(sockfd,NULL)) { /* we are connected, awesome! */ *connected = TRUE; return CURLE_OK; @@ -525,7 +533,7 @@ bool *connected) /* really connected? */ { struct SessionHandle *data = conn->data; - int rc; + int rc, error; curl_socket_t sockfd= CURL_SOCKET_BAD; int aliasindex=0; char *hostname; @@ -643,7 +651,7 @@ #endif if(-1 == rc) { - int error=Curl_ourerrno(); + error = Curl_ourerrno(); switch (error) { case EINPROGRESS: @@ -680,7 +688,7 @@ } if(0 == rc) { - if (verifyconnect(sockfd)) { + if (verifyconnect(sockfd,NULL)) { /* we are connected, awesome! */ *connected = TRUE; /* this is a true connect */ break; @@ -688,10 +696,12 @@ /* nope, not connected for real */ rc = -1; } + else + verifyconnect(sockfd,&error); /* get non-blocking error */ /* connect failed or timed out */ sclose(sockfd); - sockfd = -1; + sockfd = CURL_SOCKET_BAD; /* get a new timeout for next attempt */ after = Curl_tvnow(); @@ -705,7 +715,7 @@ if (sockfd == CURL_SOCKET_BAD) { /* no good connect was made */ *sockconn = -1; - failf(data, "Connect failed; %s", Curl_strerror(conn,Curl_ourerrno())); + failf(data, "Connect failed; %s", Curl_strerror(conn,error)); return CURLE_COULDNT_CONNECT; }