summaryrefslogtreecommitdiffstats
path: root/libssh/src/connect.c
diff options
context:
space:
mode:
authorNicolas Viennot <nicolas@viennot.biz>2014-10-31 00:10:02 -0400
committerNicolas Viennot <nicolas@viennot.biz>2014-10-31 00:30:36 -0400
commit6e4adcc140102b80883bba85dff05003620b0029 (patch)
treecf7c368b6dfb57c6c6be8b20bfe75995aae5ff63 /libssh/src/connect.c
parent0783022d6d77ab3716e2a754856d40497b4cfd76 (diff)
Update libssh
Diffstat (limited to 'libssh/src/connect.c')
-rw-r--r--libssh/src/connect.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libssh/src/connect.c b/libssh/src/connect.c
index b299d41e..4ef85bc4 100644
--- a/libssh/src/connect.c
+++ b/libssh/src/connect.c
@@ -3,7 +3,7 @@
*
* This file is part of the SSH Library
*
- * Copyright (c) 2003-2009 by Aris Adamantiadis
+ * Copyright (c) 2003-2013 by Aris Adamantiadis
*
* The SSH Library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -382,7 +382,15 @@ socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host,
continue;
}
- connect(s, itr->ai_addr, itr->ai_addrlen);
+ rc = connect(s, itr->ai_addr, itr->ai_addrlen);
+ if (rc == -1 && (errno != EINPROGRESS)) {
+ ssh_set_error(session, SSH_FATAL,
+ "Failed to connect: %s", strerror(errno));
+ ssh_connect_socket_close(s);
+ s = -1;
+ continue;
+ }
+
break;
}
@@ -421,7 +429,7 @@ static int ssh_select_cb (socket_t fd, int revents, void *userdata){
* @param[in] readfds A fd_set of file descriptors to be select'ed for
* reading.
*
- * @param[in] timeout A timeout for the select.
+ * @param[in] timeout The timeout in milliseconds.
*
* @return SSH_OK on success,
* SSH_ERROR on error,