aboutsummaryrefslogtreecommitdiff
path: root/lib/ssluse.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-03-10 08:43:01 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-03-10 08:43:01 +0000
commit40e892bb36010778d1d7a30f399dd900fab01702 (patch)
tree1e49fe3128870038037446400c1b898def24f2a6 /lib/ssluse.c
parentbc6f3beb9c4870cdb9aff6931fd964f769316935 (diff)
Jeff Lawson fixed the SSL connection to deal with received signals during the
connect.
Diffstat (limited to 'lib/ssluse.c')
-rw-r--r--lib/ssluse.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index b2f1e82e6..f91b79a70 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -44,6 +44,7 @@
#include "url.h" /* for the ssl config check function */
#include "inet_pton.h"
#include "ssluse.h"
+#include "connect.h" /* Curl_ourerrno() proto */
#ifdef USE_SSLEAY
#include <openssl/rand.h>
@@ -1157,18 +1158,28 @@ Curl_SSLConnect(struct connectdata *conn,
interval.tv_usec = timeout_ms*1000;
- what = select(sockfd+1, &readfd, &writefd, NULL, &interval);
- if(what > 0)
- /* reabable or writable, go loop yourself */
- continue;
- else if(0 == what) {
- /* timeout */
- failf(data, "SSL connection timeout");
- return CURLE_OPERATION_TIMEOUTED;
- }
- else
- break; /* get out of loop */
- } /* loop */
+ while(1) {
+ what = select(sockfd+1, &readfd, &writefd, NULL, &interval);
+ if(what > 0)
+ /* reabable or writable, go loop in the outer loop */
+ break;
+ else if(0 == what) {
+ /* timeout */
+ failf(data, "SSL connection timeout");
+ return CURLE_OPERATION_TIMEDOUT;
+ }
+ else {
+#ifdef EINTR
+ /* For platforms without EINTR all errnos are bad */
+ if (errno == EINTR)
+ continue; /* retry the select() */
+#endif
+ /* anything other than the unimportant EINTR is fatally bad */
+ failf(data, "select on SSL socket, errno: %d", Curl_ourerrno());
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ } /* while()-loop for the select() */
+ } /* while()-loop for the SSL_connect() */
/* Informational message */
infof (data, "SSL connection using %s\n",