diff options
author | moonbreon <yakoup46@gmail.com> | 2023-09-08 04:25:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-08 11:25:23 +0300 |
commit | 43b1a2e25ed1275ccd60e6c2c7eed550ee44adf7 (patch) | |
tree | 0b60544015d2f2c9bc056f7687fc5d2cb3413bd2 /libnetdata | |
parent | 85e93d18a8e57257220d24637505f90771563289 (diff) |
don't return `-1` if the socket was closed (#15771)
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/socket/security.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libnetdata/socket/security.c b/libnetdata/socket/security.c index c1bb763456..3a3a171e52 100644 --- a/libnetdata/socket/security.c +++ b/libnetdata/socket/security.c @@ -234,6 +234,11 @@ ssize_t netdata_ssl_read(NETDATA_SSL *ssl, void *buf, size_t num) { if(unlikely(bytes <= 0)) { int err = SSL_get_error(ssl->conn, bytes); + if (err == SSL_ERROR_ZERO_RETURN) { + ssl->ssl_errno = err; + return 0; + } + if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) { ssl->ssl_errno = err; errno = EWOULDBLOCK; |