From: Lars Ingebrigtsen Date: Mon, 13 Feb 2012 19:37:48 +0000 (+0100) Subject: Further GnuTLS EAGAIN write fixups X-Git-Tag: emacs-pretest-24.0.94~150 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2e8f3c56f0217d29ce9e229268331cef2a1e8739;p=emacs.git Further GnuTLS EAGAIN write fixups * gnutls.c (emacs_gnutls_write): Set errno appropriately for send_process. --- diff --git a/src/ChangeLog b/src/ChangeLog index d9c02e011ad..b4af412ed7b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-02-13 Lars Ingebrigtsen + + * gnutls.c (emacs_gnutls_write): Set errno appropriately for + send_process. + 2012-02-13 Stefan Monnier * keymap.c (Fsingle_key_description): Handle char ranges. diff --git a/src/gnutls.c b/src/gnutls.c index 5da84bdd960..84ceeaf3119 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -365,8 +365,20 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte) { if (rtnval == GNUTLS_E_INTERRUPTED) continue; - else + else { + /* If we get EAGAIN, then set errno appropriately so that + send_process retries the correct way instead of + erroring out. */ + if (rtnval == EAGAIN) { +#ifdef EWOULDBLOCK + errno = EWOULDBLOCK; +#endif +#ifdef EAGAIN + errno = EAGAIN; +#endif + } break; + } } buf += rtnval;