Check setsockopt() return value in net_bind()
This commit is contained in:
parent
3d8fb63e11
commit
874bd64b28
1 changed files with 7 additions and 2 deletions
|
@ -281,8 +281,13 @@ int net_bind( int *fd, const char *bind_ip, int port )
|
|||
}
|
||||
|
||||
n = 1;
|
||||
setsockopt( *fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
(const char *) &n, sizeof( n ) );
|
||||
if( setsockopt( *fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
(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 )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue