diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-03-25 08:49:34 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-03-25 08:49:34 +0100 |
commit | 24908c12d7757b5a14c12bd0c3560689c70f65e7 (patch) | |
tree | e45bccddae3db0671690f23ac8453cb37c428e3e /lib | |
parent | 4e299192ed3310b387d0c95d0d0d4d145991aef7 (diff) |
polarssl: remove superfluous for(;;) loop
"unreachable: Since the loop increment is unreachable, the loop body
will never execute more than once."
Coverity CID 1291707
Diffstat (limited to 'lib')
-rw-r--r-- | lib/vtls/polarssl.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c index 0a7311c2c..940692cb2 100644 --- a/lib/vtls/polarssl.c +++ b/lib/vtls/polarssl.c @@ -398,32 +398,29 @@ polarssl_connect_step2(struct connectdata *conn, conn->recv[sockindex] = polarssl_recv; conn->send[sockindex] = polarssl_send; - for(;;) { - if(!(ret = ssl_handshake(&connssl->ssl))) - break; - else if(ret != POLARSSL_ERR_NET_WANT_READ && - ret != POLARSSL_ERR_NET_WANT_WRITE) { + if(!(ret = ssl_handshake(&connssl->ssl))) + ; + else if(ret != POLARSSL_ERR_NET_WANT_READ && + ret != POLARSSL_ERR_NET_WANT_WRITE) { #ifdef POLARSSL_ERROR_C - error_strerror(ret, errorbuf, sizeof(errorbuf)); + error_strerror(ret, errorbuf, sizeof(errorbuf)); #endif /* POLARSSL_ERROR_C */ - failf(data, "ssl_handshake returned - PolarSSL: (-0x%04X) %s", - -ret, errorbuf); + failf(data, "ssl_handshake returned - PolarSSL: (-0x%04X) %s", + -ret, errorbuf); - return CURLE_SSL_CONNECT_ERROR; + return CURLE_SSL_CONNECT_ERROR; + } + else { + if(ret == POLARSSL_ERR_NET_WANT_READ) { + connssl->connecting_state = ssl_connect_2_reading; + return CURLE_OK; } - else { - if(ret == POLARSSL_ERR_NET_WANT_READ) { - connssl->connecting_state = ssl_connect_2_reading; - return CURLE_OK; - } - if(ret == POLARSSL_ERR_NET_WANT_WRITE) { - connssl->connecting_state = ssl_connect_2_writing; - return CURLE_OK; - } - failf(data, "SSL_connect failed with error %d.", ret); - return CURLE_SSL_CONNECT_ERROR; - + if(ret == POLARSSL_ERR_NET_WANT_WRITE) { + connssl->connecting_state = ssl_connect_2_writing; + return CURLE_OK; } + failf(data, "SSL_connect failed with error %d.", ret); + return CURLE_SSL_CONNECT_ERROR; } infof(data, "PolarSSL: Handshake complete, cipher is %s\n", |