aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-09-25 13:05:36 +0000
committerYang Tse <yangsita@gmail.com>2009-09-25 13:05:36 +0000
commitc7c84e74201c102c213c4230af40f11e2114c33a (patch)
tree963017c66fb88518c4ac86caafce235ee87b263b /lib
parent37489a855f6d7bb159ab6d12588b924c4939afe4 (diff)
fix compiler warning: end-of-loop code not reached
Diffstat (limited to 'lib')
-rw-r--r--lib/ssluse.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 8d4490fa6..363c27a1e 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -2300,6 +2300,7 @@ ossl_connect_common(struct connectdata *conn,
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
curl_socket_t sockfd = conn->sock[sockindex];
long timeout_ms;
+ int what;
if(ssl_connect_1==connssl->connecting_state) {
/* Find out how much more time we're allowed */
@@ -2337,32 +2338,27 @@ ossl_connect_common(struct connectdata *conn,
curl_socket_t readfd = ssl_connect_2_reading==
connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
- while(1) {
- int what = Curl_socket_ready(readfd, writefd,
- nonblocking?0:(int)timeout_ms);
- if(what > 0)
- /* readable or writable, go loop in the outer loop */
- break;
- else if(0 == what) {
- if(nonblocking) {
- *done = FALSE;
- return CURLE_OK;
- }
- else {
- /* timeout */
- failf(data, "SSL connection timeout");
- return CURLE_OPERATION_TIMEDOUT;
- }
+ what = Curl_socket_ready(readfd, writefd,
+ nonblocking?0:(int)timeout_ms);
+ if(what < 0) {
+ /* fatal error */
+ failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
+ return CURLE_SSL_CONNECT_ERROR;
+ }
+ else if(0 == what) {
+ if(nonblocking) {
+ *done = FALSE;
+ return CURLE_OK;
}
else {
- /* anything that gets here is fatally bad */
- failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
- return CURLE_SSL_CONNECT_ERROR;
+ /* timeout */
+ failf(data, "SSL connection timeout");
+ return CURLE_OPERATION_TIMEDOUT;
}
- } /* while()-loop for the select() */
+ }
+ /* socket is readable or writable */
}
- /* get the timeout from step2 to avoid computing it twice. */
retcode = ossl_connect_step2(conn, sockindex);
if(retcode)
return retcode;