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:
parent
0071c423d5
commit
1a75461594
1 changed files with 2 additions and 2 deletions
|
@ -248,7 +248,7 @@ rb_ssl_accept_common(rb_fde_t *const F, void *const data)
|
||||||
F->handshake_count++;
|
F->handshake_count++;
|
||||||
ad->callback(F, RB_OK, (struct sockaddr *)&ad->S, ad->addrlen, ad->data);
|
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;
|
errno = err;
|
||||||
ad->callback(F, RB_ERROR, NULL, 0, ad->data);
|
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++;
|
F->handshake_count++;
|
||||||
rb_ssl_connect_realcb(F, RB_OK, sconn);
|
rb_ssl_connect_realcb(F, RB_OK, sconn);
|
||||||
}
|
}
|
||||||
else if(err != 0)
|
else if(ret == GNUTLS_E_INTERRUPTED && err != 0)
|
||||||
{
|
{
|
||||||
errno = err;
|
errno = err;
|
||||||
rb_ssl_connect_realcb(F, RB_ERROR, sconn);
|
rb_ssl_connect_realcb(F, RB_ERROR, sconn);
|
||||||
|
|
Loading…
Reference in a new issue