emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 202ff53: Handle GNUTLS_E_AGAIN in emacs_gnutls_re


From: Noam Postavsky
Subject: [Emacs-diffs] emacs-26 202ff53: Handle GNUTLS_E_AGAIN in emacs_gnutls_read (Bug#34341)
Date: Mon, 13 May 2019 20:19:42 -0400 (EDT)

branch: emacs-26
commit 202ff53da267f9fa15f438e9c38603bbead6e890
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Handle GNUTLS_E_AGAIN in emacs_gnutls_read (Bug#34341)
    
    Don't merge to master, this has already been fixed there by 2019-01-15
    "Fix unlikely races with GnuTLS, datagrams".
    * src/gnutls.c (emacs_gnutls_read): Similar to emacs_gnutls_write,
    when gnutls_record_recv returns GNUTLS_E_AGAIN set errno to EGAIN.
---
 src/gnutls.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gnutls.c b/src/gnutls.c
index 3c16b6c..b724c35 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -753,8 +753,15 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, 
ptrdiff_t nbyte)
     /* The peer closed the connection. */
     return 0;
   else if (emacs_gnutls_handle_error (state, rtnval))
-    /* non-fatal error */
-    return -1;
+    {
+      /* If we get GNUTLS_E_AGAIN, then set errno appropriately so that
+         wait_reading_process_output retries the correct way instead of
+         erroring out.  */
+      if (rtnval == GNUTLS_E_AGAIN)
+        errno = EAGAIN;
+      /* non-fatal error */
+      return -1;
+    }
   else {
     /* a fatal error occurred */
     return 0;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]