(emacs_gnutls_read): Return 0 if we get a non-"EAGAIN"-like error to signal to Emacs...
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 18 Oct 2010 20:32:54 +0000 (22:32 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 18 Oct 2010 20:32:54 +0000 (22:32 +0200)
src/ChangeLog
src/gnutls.c

index b3ed712..7755ed8 100644 (file)
@@ -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
index 577cca2..1cc258a 100644 (file)
@@ -125,8 +125,13 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf,
   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