diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-05-12 19:15:27 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-05-13 19:26:06 +0200 |
commit | afecd85db1359b5a62c037b8a507b928541c779c (patch) | |
tree | 26c1def792b0e9e80a8042ef87e9d5cfbc9093d1 /crypto/bio/bss_conn.c | |
parent | 2bdec3b037264540014120a02217fc67bf355f11 (diff) |
Replace some of the ERR_clear_error() calls with mark calls
Fixes #15219
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/15253)
Diffstat (limited to 'crypto/bio/bss_conn.c')
-rw-r--r-- | crypto/bio/bss_conn.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 7aaae65bc2..3ab2c0d4ba 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -155,6 +155,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) case BIO_CONN_S_CONNECT: BIO_clear_retry_flags(b); + ERR_set_mark(); ret = BIO_connect(b->num, BIO_ADDRINFO_address(c->addr_iter), BIO_SOCK_KEEPALIVE | c->connect_mode); b->retry_reason = 0; @@ -163,7 +164,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) BIO_set_retry_special(b); c->state = BIO_CONN_S_BLOCKED_CONNECT; b->retry_reason = BIO_RR_CONNECT; - ERR_clear_error(); + ERR_pop_to_mark(); } else if ((c->addr_iter = BIO_ADDRINFO_next(c->addr_iter)) != NULL) { /* @@ -171,9 +172,10 @@ static int conn_state(BIO *b, BIO_CONNECT *c) */ BIO_closesocket(b->num); c->state = BIO_CONN_S_CREATE_SOCKET; - ERR_clear_error(); + ERR_pop_to_mark(); break; } else { + ERR_clear_last_mark(); ERR_raise_data(ERR_LIB_SYS, get_last_socket_error(), "calling connect(%s, %s)", c->param_hostname, c->param_service); @@ -182,6 +184,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) } goto exit_loop; } else { + ERR_clear_last_mark(); c->state = BIO_CONN_S_OK; } break; @@ -196,7 +199,6 @@ static int conn_state(BIO *b, BIO_CONNECT *c) */ BIO_closesocket(b->num); c->state = BIO_CONN_S_CREATE_SOCKET; - ERR_clear_error(); break; } ERR_raise_data(ERR_LIB_SYS, i, |