diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-02-24 22:41:40 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-02-24 22:41:40 -0800 |
commit | a89654f8f34114db543cb91363e8fded6d73e986 (patch) | |
tree | 5ac508597ef2aa460308b4b26c244779e48cdb40 /src/gnutls.c | |
parent | 6e6c82a4e687708d5a7a3887f92db45bd74da276 (diff) | |
parent | 67b0de11479247cb8bd8491e10e0b464046f18be (diff) | |
download | emacs-a89654f8f34114db543cb91363e8fded6d73e986.tar.gz |
Merge from trunk.
Diffstat (limited to 'src/gnutls.c')
-rw-r--r-- | src/gnutls.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/gnutls.c b/src/gnutls.c index a4eeb50bd74..99fc5c10e2b 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -345,15 +345,16 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) ptrdiff_t 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; + errno = EWOULDBLOCK; #endif #ifdef EAGAIN - errno = EAGAIN; + errno = EAGAIN; #endif - return 0; - } + return 0; + } bytes_written = 0; @@ -363,10 +364,24 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) if (rtnval < 0) { - if (rtnval == GNUTLS_E_AGAIN || rtnval == GNUTLS_E_INTERRUPTED) + if (rtnval == GNUTLS_E_INTERRUPTED) continue; else - break; + { + /* If we get GNUTLS_E_AGAIN, then set errno + appropriately so that send_process retries the + correct way instead of erroring out. */ + if (rtnval == GNUTLS_E_AGAIN) + { +#ifdef EWOULDBLOCK + errno = EWOULDBLOCK; +#endif +#ifdef EAGAIN + errno = EAGAIN; +#endif + } + break; + } } buf += rtnval; |