aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-06-01 20:31:39 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-06-01 21:12:52 +0200
commitc96cd51fe73fddb4e9188e4f857938d33f386664 (patch)
tree36378331b5fe2415ef18a363608757883fc47bae /src
parentc8080eb22362630b7a735d30da55dd23779cd83c (diff)
Don't call SSL_get_error() with pending data
When a positive non-zero value is returned from SSL_read or SSL_write, there is data read or written, so there is no need to check for errors. Only in the case the return value is 0 or negative.
Diffstat (limited to 'src')
-rw-r--r--src/IO/tls_openssl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c
index 3e53800d..10a68dbd 100644
--- a/src/IO/tls_openssl.c
+++ b/src/IO/tls_openssl.c
@@ -1272,6 +1272,12 @@ void a_Tls_openssl_connect(int fd, const DilloUrl *url)
*/
static int Tls_handle_error(Conn_t *conn, int ret, const char *where)
{
+ /* Success */
+ if (ret > 0) {
+ errno = 0;
+ return ret;
+ }
+
SSL *ssl = conn->ssl;
int err1_ret = SSL_get_error(ssl, ret);
if (err1_ret == SSL_ERROR_NONE) {