mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 09:48:31 +00:00
Backup errno in net_would_block
Safe and restore the value of errno in net_would_block to be sure it's not affected by the guarding call to fcntl. Fixes #845.
This commit is contained in:
parent
b65c2be5f1
commit
a6ed9c5429
2 changed files with 12 additions and 1 deletions
|
@ -1,5 +1,11 @@
|
|||
mbed TLS ChangeLog (Sorted per branch, date)
|
||||
|
||||
= mbed TLS x.x.x branch released xxxx-xx-xx
|
||||
|
||||
Bugfix
|
||||
* Fix net_would_block to avoid modification by errno through fcntl call.
|
||||
Found by nkolban. Fixes #845.
|
||||
|
||||
= mbed TLS 2.4.2 branch released 2017-03-08
|
||||
|
||||
Security
|
||||
|
|
|
@ -270,13 +270,18 @@ static int net_would_block( const mbedtls_net_context *ctx )
|
|||
*/
|
||||
static int net_would_block( const mbedtls_net_context *ctx )
|
||||
{
|
||||
int err = errno;
|
||||
|
||||
/*
|
||||
* Never return 'WOULD BLOCK' on a non-blocking socket
|
||||
*/
|
||||
if( ( fcntl( ctx->fd, F_GETFL ) & O_NONBLOCK ) != O_NONBLOCK )
|
||||
{
|
||||
errno = err;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
switch( errno )
|
||||
switch( errno = err )
|
||||
{
|
||||
#if defined EAGAIN
|
||||
case EAGAIN:
|
||||
|
|
Loading…
Reference in a new issue