From: Lars Magne Ingebrigtsen Date: Sun, 10 Oct 2010 18:47:45 +0000 (+0200) Subject: Fix gnutls write-before-negotiation case. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~46^2~74 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=355cdaf37b7eeef16d23c4bf7fce7b69d56423ec;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index e2c92031659..1c75c758498 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-10-10 Lars Magne Ingebrigtsen + + * 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 * vm-limit.c: diff --git a/src/gnutls.c b/src/gnutls.c index d9ccaa5a62c..577cca247ee 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -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;