changeset 110907:1ccdcdef34fc

Fix gnutls write-before-negotiation case. * gnutls.c (emacs_gnutls_write): If we're trying to write before gnutls is ready, return EAGAIN as the errno.
author Lars Magne Ingebrigtsen <larsi@gnus.org>
date Sun, 10 Oct 2010 20:47:45 +0200
parents b9752b72e1ee
children 2a4bfc24abf0
files src/ChangeLog src/gnutls.c
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Oct 10 08:49:31 2010 -0700
+++ b/src/ChangeLog	Sun Oct 10 20:47:45 2010 +0200
@@ -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:
--- a/src/gnutls.c	Sun Oct 10 08:49:31 2010 -0700
+++ b/src/gnutls.c	Sun Oct 10 20:47:45 2010 +0200
@@ -77,8 +77,15 @@
   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;