]> git.eshelyaron.com Git - emacs.git/commit
Fix unlikely races with GnuTLS, datagrams
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 16 Jan 2019 07:51:45 +0000 (23:51 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 16 Jan 2019 07:52:47 +0000 (23:52 -0800)
commite87e6a24c49542111e669b7d0f1a412024663f8e
treeba382d326874795c7b131a7995c67e660650a80c
parent6b9fa8804533a695094a930d634d2d6617e2b6c7
Fix unlikely races with GnuTLS, datagrams

Retry some calls if interrupted at inopportune times.
These were found by code inspection.
* src/gnutls.c (gnutls_try_handshake): Simplify by using
new emacs_gnutls_handle_error API.
(emacs_gnutls_write): Remove GNUTLS_E_AGAIN hack since
emacs_gnutls_handle_error now does that.
Use emacs_gnutls_handle_error only on errors.
(emacs_gnutls_read): Retry if gnutls_record_recv returns
GNUTLS_E_INTERRUPTED, to be consistent with emacs_read.
(emacs_gnutls_handle_error): Return 0 on fatal errors,
-1 (setting errno) on ordinary errors, to simplify callers.
Assume that ERR is negative, since it always is now.
Map non-fatal GnuTLS errors to errno values as best we can.
* src/process.c (read_process_output) [DATAGRAM_SOCKETS]:
Retry recvfrom if it is interrupted, to be consistent with
how things are handled when not a datagram channel.
(send_process) [DATAGRAM_SOCEKTS]: If sendto is interrupted,
process pending signals and retry it, to be consistent with
how things are handled when not a datagram channel.
src/gnutls.c
src/process.c