Skip to content

Commit

Permalink
Ensure that bind's socket is set non-blocking if the bind is so marked.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmundkur committed Mar 15, 2017
1 parent f988ca2 commit df0fd27
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/bind.c
Expand Up @@ -124,6 +124,16 @@ static socket_t bind_socket(ssh_bind sshbind, const char *hostname,
CLOSE_SOCKET(s);
return -1;
}
if (!sshbind->blocking) {
if (ssh_socket_set_nonblocking(s) != 0) {
ssh_set_error(sshbind,
SSH_FATAL,
"Setting socket non-blocking failed: %s",
strerror(errno));
CLOSE_SOCKET(s);
return -1;
}
}

freeaddrinfo (ai);
return s;
Expand Down

0 comments on commit df0fd27

Please sign in to comment.