]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix gnutls write-before-negotiation case.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 10 Oct 2010 18:47:45 +0000 (20:47 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 10 Oct 2010 18:47:45 +0000 (20:47 +0200)
* gnutls.c (emacs_gnutls_write): If we're trying to write before
gnutls is ready, return EAGAIN as the errno.

src/ChangeLog
src/gnutls.c

index e2c92031659437e83d1ea44beb21c71c9347b3f8..1c75c758498a12ce93af5fe42e582d2806ef4efe 100644 (file)
@@ -1,3 +1,8 @@
+2010-10-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnutls.c (emacs_gnutls_write): If we're trying to write before
+       gnutls is ready, return EAGAIN as the errno.
+
 2010-10-10  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * vm-limit.c:
index d9ccaa5a62c49738f6919dd9a34a1d0611bbaf22..577cca247eeede3c8315391faa806aeea1059886 100644 (file)
@@ -77,8 +77,15 @@ emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf,
   register int rtnval, bytes_written;
   gnutls_session_t state = proc->gnutls_state;
 
-  if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
+  if (proc->gnutls_initstage != GNUTLS_STAGE_READY) {
+#ifdef EWOULDBLOCK
+    errno = EWOULDBLOCK;
+#endif
+#ifdef EAGAIN
+    errno = EAGAIN;
+#endif
     return -1;
+  }
 
   bytes_written = 0;