Skip to content

Commit

Permalink
Fix #1174, Check Return Value of setsockopt
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu007-creator committed Oct 7, 2021
1 parent 42af0f7 commit 3242960
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/os/portable/os-impl-bsd-sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ int32 OS_SocketOpen_Impl(const OS_object_token_t *token)
* code restarts. However if setting the option fails then it is not worth bailing out over.
*/
os_flags = 1;
if (setsockopt(impl->fd, SOL_SOCKET, SO_REUSEADDR, &os_flags, sizeof(os_flags)) == 0)
{
setsockopt(impl->fd, SOL_SOCKET, SO_REUSEADDR, &os_flags, sizeof(os_flags));
}

/*
* Set the standard options on the filehandle by default --
Expand Down

0 comments on commit 3242960

Please sign in to comment.