mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 17:15:38 +01:00
Check setsockopt() return value in net_bind()
This commit is contained in:
parent
3d8fb63e11
commit
874bd64b28
@ -281,8 +281,13 @@ int net_bind( int *fd, const char *bind_ip, int port )
|
|||||||
}
|
}
|
||||||
|
|
||||||
n = 1;
|
n = 1;
|
||||||
setsockopt( *fd, SOL_SOCKET, SO_REUSEADDR,
|
if( setsockopt( *fd, SOL_SOCKET, SO_REUSEADDR,
|
||||||
(const char *) &n, sizeof( n ) );
|
(const char *) &n, sizeof( n ) ) != 0 )
|
||||||
|
{
|
||||||
|
close( *fd );
|
||||||
|
ret = POLARSSL_ERR_NET_SOCKET_FAILED;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( bind( *fd, cur->ai_addr, cur->ai_addrlen ) != 0 )
|
if( bind( *fd, cur->ai_addr, cur->ai_addrlen ) != 0 )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user