GNUTLS: Minor fix to rb_ssl_accept_common()/rb_ssl_connect_common()

Properly check whether the library was interrupted by the kernel
before assuming that a nonzero errno was caused by the kernel.

Otherwise, a memory allocation failure in the library for example
would incorrectly be interpreted as a syscall error instead of a
library error.
This commit is contained in:
Aaron Jones 2016-09-16 22:27:45 +00:00
parent 0071c423d5
commit 1a75461594
No known key found for this signature in database
GPG key ID: EC6F86EE9CD840B5

View file

@ -248,7 +248,7 @@ rb_ssl_accept_common(rb_fde_t *const F, void *const data)
F->handshake_count++;
ad->callback(F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
}
else if(err != 0)
else if(ret == GNUTLS_E_INTERRUPTED && err != 0)
{
errno = err;
ad->callback(F, RB_ERROR, NULL, 0, ad->data);
@ -632,7 +632,7 @@ rb_ssl_connect_common(rb_fde_t *const F, void *const data)
F->handshake_count++;
rb_ssl_connect_realcb(F, RB_OK, sconn);
}
else if(err != 0)
else if(ret == GNUTLS_E_INTERRUPTED && err != 0)
{
errno = err;
rb_ssl_connect_realcb(F, RB_ERROR, sconn);