From e051135a0516f686456b9f3d089f91ded177ef1a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 25 Dec 2014 12:33:29 +0100 Subject: connect: Check that errno is 0 to fix Windows build. Thanks to Viktor Butskih. Signed-off-by: Andreas Schneider --- src/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/connect.c b/src/connect.c index 4ef85bc4..da1bf443 100644 --- a/src/connect.c +++ b/src/connect.c @@ -382,8 +382,9 @@ socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host, continue; } + errno = 0; rc = connect(s, itr->ai_addr, itr->ai_addrlen); - if (rc == -1 && (errno != EINPROGRESS)) { + if (rc == -1 && (errno != 0) && (errno != EINPROGRESS)) { ssh_set_error(session, SSH_FATAL, "Failed to connect: %s", strerror(errno)); ssh_connect_socket_close(s); -- cgit v1.2.3