From 2ae9e6a219dae5a80b393309573cb5f8263db854 Mon Sep 17 00:00:00 2001
From: Davide Galassi <davide.galassi@gmail.com>
Date: Mon, 18 Apr 2016 14:52:31 +0200
Subject: [PATCH] BIO socket connect failure was not handled correctly. The
 state was always set to BIO_CONN_S_OK.

---
 crypto/bio/bss_conn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c
index a4949b3..c1abe87 100644
--- a/crypto/bio/bss_conn.c
+++ b/crypto/bio/bss_conn.c
@@ -198,7 +198,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
             ret = BIO_connect(b->num, BIO_ADDRINFO_address(c->addr_iter),
                               BIO_SOCK_KEEPALIVE | c->connect_mode);
             b->retry_reason = 0;
-            if (ret < 0) {
+            if (ret == 0) {
                 if (BIO_sock_should_retry(ret)) {
                     BIO_set_retry_special(b);
                     c->state = BIO_CONN_S_BLOCKED_CONNECT;
-- 
2.8.0

