Commit d5f270f2 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen
Browse files

Return the correct error values from gnutls.c

* src/gnutls.c (emacs_gnutls_read): Set errno to the value
expected by process.c.
(gnutls_try_handshake): Set gnutls_p to true earlier to avoid
possible race condition with the process.c socket polling
functions.
parent b829c9e1
......@@ -403,6 +403,9 @@ gnutls_try_handshake (struct Lisp_Process *proc)
gnutls_session_t state = proc->gnutls_state;
int ret;
if (proc->is_non_blocking_client)
proc->gnutls_p = true;
do
{
ret = gnutls_handshake (state);
......@@ -414,9 +417,6 @@ gnutls_try_handshake (struct Lisp_Process *proc)
proc->gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED;
if (proc->is_non_blocking_client)
proc->gnutls_p = true;
if (ret == GNUTLS_E_SUCCESS)
{
/* Here we're finally done. */
......@@ -541,7 +541,10 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
gnutls_session_t state = proc->gnutls_state;
if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
return -1;
{
errno = EAGAIN;
return -1;
}
rtnval = gnutls_record_recv (state, buf, nbyte);
if (rtnval >= 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment