changeset 111025:54ea07fb88fc

(emacs_gnutls_read): Return 0 if we get a non-"EAGAIN"-like error to signal to Emacs that the socket should be closed.
author Lars Magne Ingebrigtsen <larsi@gnus.org>
date Mon, 18 Oct 2010 22:32:54 +0200
parents de3915e14c4c
children 40219338786d
files src/ChangeLog src/gnutls.c
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Oct 18 13:26:25 2010 -0400
+++ b/src/ChangeLog	Mon Oct 18 22:32:54 2010 +0200
@@ -1,3 +1,9 @@
+2010-10-18  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnutls.c (emacs_gnutls_read): Return 0 if we get a
+	non-"EAGAIN"-like error to signal to Emacs that the socket should
+	be closed.
+
 2010-10-15  Eli Zaretskii  <eliz@gnu.org>
 
 	* unexcoff.c (make_hdr): Fix prototype according to changes in
--- a/src/gnutls.c	Mon Oct 18 13:26:25 2010 -0400
+++ b/src/gnutls.c	Mon Oct 18 22:32:54 2010 +0200
@@ -125,8 +125,13 @@
   rtnval = gnutls_read (state, buf, nbyte);
   if (rtnval >= 0)
     return rtnval;
-  else
-    return -1;
+  else {
+    if (rtnval == GNUTLS_E_AGAIN ||
+	rtnval == GNUTLS_E_INTERRUPTED)
+      return -1;
+    else
+      return 0;
+  }
 }
 
 /* convert an integer error to a Lisp_Object; it will be either a