aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-06-17 13:33:52 +0200
committerAndreas Schneider <asn@cynapses.org>2010-06-17 13:33:52 +0200
commit21d918c68aab56111df7dee7879a6b21427b7a2f (patch)
treef2cece302dd0b425589244a7ca1ff08ecef7eca4
parent544fc28e6b07b27f755eeff6bcd74ae49d9e310a (diff)
downloadlibssh-21d918c68aab56111df7dee7879a6b21427b7a2f.tar.gz
libssh-21d918c68aab56111df7dee7879a6b21427b7a2f.tar.xz
libssh-21d918c68aab56111df7dee7879a6b21427b7a2f.zip
client: Fixed fd type and checks.
-rw-r--r--libssh/client.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libssh/client.c b/libssh/client.c
index 3999f990..c248083f 100644
--- a/libssh/client.c
+++ b/libssh/client.c
@@ -481,7 +481,7 @@ int ssh_service_request(ssh_session session, const char *service) {
int ssh_connect(ssh_session session) {
int ssh1 = 0;
int ssh2 = 0;
- int fd = -1;
+ socket_t fd = SSH_INVALID_SOCKET;
int ret;
if (session == NULL) {
@@ -498,7 +498,7 @@ int ssh_connect(ssh_session session) {
leave_function();
return SSH_ERROR;
}
- if (session->fd == -1 && session->host == NULL &&
+ if (session->fd == SSH_INVALID_SOCKET && session->host == NULL &&
session->ProxyCommand == NULL) {
ssh_set_error(session, SSH_FATAL, "Hostname required");
leave_function();
@@ -512,7 +512,7 @@ int ssh_connect(ssh_session session) {
return SSH_ERROR;
}
- if (session->fd != -1) {
+ if (session->fd != SSH_INVALID_SOCKET) {
fd = session->fd;
#ifndef _WIN32
} else if (session->ProxyCommand != NULL) {
@@ -522,7 +522,7 @@ int ssh_connect(ssh_session session) {
fd = ssh_connect_host(session, session->host, session->bindaddr,
session->port, session->timeout, session->timeout_usec);
}
- if (fd < 0) {
+ if (fd == SSH_INVALID_SOCKET) {
leave_function();
return SSH_ERROR;
}