summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2020-09-06 12:15:10 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2020-09-06 12:15:10 +0100
commitd52a8ce8499fbb88f4670623df9f52d3e790292b (patch)
treea8af9386e22f83b8a99d72b5cd8ba55ac2739d00 /src
parentbc2767e61d9d31d2fb05078b0214d84d5e68d23d (diff)
GnuTLS: clear errno before any data i/o op, so error logging does not see stale values
Diffstat (limited to 'src')
-rw-r--r--src/src/tls-gnu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c
index bfe40b205..03af7d7dc 100644
--- a/src/src/tls-gnu.c
+++ b/src/src/tls-gnu.c
@@ -3167,6 +3167,7 @@ DEBUG(D_tls) debug_printf("Calling gnutls_record_recv(session=%p, buffer=%p, buf
sigalrm_seen = FALSE;
if (smtp_receive_timeout > 0) ALARM(smtp_receive_timeout);
+errno = 0;
do
inbytes = gnutls_record_recv(state->session, state->xfer_buffer,
MIN(ssl_xfer_buffer_size, lim));
@@ -3327,6 +3328,7 @@ DEBUG(D_tls)
debug_printf("Calling gnutls_record_recv(session=%p, buffer=%p, len=" SIZE_T_FMT ")\n",
state->session, buff, len);
+errno = 0;
do
inbytes = gnutls_record_recv(state->session, buff, len);
while (inbytes == GNUTLS_E_AGAIN);
@@ -3390,6 +3392,7 @@ while (left > 0)
DEBUG(D_tls) debug_printf("gnutls_record_send(session=%p, buffer=%p, left=" SIZE_T_FMT ")\n",
state->session, buff, left);
+ errno = 0;
do
outbytes = gnutls_record_send(state->session, buff, left);
while (outbytes == GNUTLS_E_AGAIN);