aboutsummaryrefslogtreecommitdiff
path: root/src/connect.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2014-12-25 12:33:29 +0100
committerAndreas Schneider <asn@cryptomilk.org>2014-12-25 12:34:59 +0100
commite051135a0516f686456b9f3d089f91ded177ef1a (patch)
treeb9cf3d36fe44b3a7383175e1eeda35e4fc07bf4c /src/connect.c
parentbb18442fe8f58a483713eb2b988b3da9869ddf86 (diff)
downloadlibssh-e051135a0516f686456b9f3d089f91ded177ef1a.tar.gz
libssh-e051135a0516f686456b9f3d089f91ded177ef1a.tar.xz
libssh-e051135a0516f686456b9f3d089f91ded177ef1a.zip
connect: Check that errno is 0 to fix Windows build.
Thanks to Viktor Butskih. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/connect.c')
-rw-r--r--src/connect.c3
1 files changed, 2 insertions, 1 deletions
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);