diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2014-12-25 12:33:29 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-12-25 12:35:24 +0100 |
commit | 0e969e0316fe6437898c31ca57a3d187e5ee59f1 (patch) | |
tree | 4a47a0ba677f107298841ffaa43699c02de71e0f | |
parent | a45dd8e00037125d0789fe6d4a8ab1557a02e5ac (diff) | |
download | libssh-0e969e0316fe6437898c31ca57a3d187e5ee59f1.tar.gz libssh-0e969e0316fe6437898c31ca57a3d187e5ee59f1.tar.xz libssh-0e969e0316fe6437898c31ca57a3d187e5ee59f1.zip |
connect: Check that errno is 0 to fix Windows build.
Thanks to Viktor Butskih.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit e051135a0516f686456b9f3d089f91ded177ef1a)
-rw-r--r-- | src/connect.c | 3 |
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); |