aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-06-17 13:47:29 +0200
committerAndreas Schneider <asn@cynapses.org>2010-06-17 13:47:29 +0200
commit558f889aae4621000f49eec4f8b668123d28c9ec (patch)
tree78a4b6b738e6d9a62b30ee4892d6a788988975d9
parent937268eb3e5462ba9ad556dd0d667ae565c7c603 (diff)
downloadlibssh-558f889aae4621000f49eec4f8b668123d28c9ec.tar.gz
libssh-558f889aae4621000f49eec4f8b668123d28c9ec.tar.xz
libssh-558f889aae4621000f49eec4f8b668123d28c9ec.zip
Fixed more fd checks.
-rw-r--r--libssh/options.c2
-rw-r--r--libssh/server.c2
-rw-r--r--libssh/socket.c4
3 files changed, 4 insertions, 4 deletions
diff --git a/libssh/options.c b/libssh/options.c
index f87af587..b7eeb273 100644
--- a/libssh/options.c
+++ b/libssh/options.c
@@ -398,7 +398,7 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
break;
case SSH_OPTIONS_FD:
if (value == NULL) {
- session->fd = -1;
+ session->fd = SSH_INVALID_SOCKET;
} else {
socket_t *x = (socket_t *) value;
diff --git a/libssh/server.c b/libssh/server.c
index ea5a670b..bfac7da3 100644
--- a/libssh/server.c
+++ b/libssh/server.c
@@ -150,7 +150,7 @@ int ssh_bind_listen(ssh_bind sshbind) {
}
fd = bind_socket(sshbind, host, sshbind->bindport);
- if (fd < 0) {
+ if (fd == SSH_INVALID_SOCKET) {
return -1;
}
sshbind->bindfd = fd;
diff --git a/libssh/socket.c b/libssh/socket.c
index 46669614..8ebf360b 100644
--- a/libssh/socket.c
+++ b/libssh/socket.c
@@ -312,7 +312,7 @@ int ssh_socket_unix(ssh_socket s, const char *path) {
snprintf(sunaddr.sun_path, sizeof(sunaddr.sun_path), "%s", path);
fd = socket(AF_UNIX, SOCK_STREAM, 0);
- if (fd < 0) {
+ if (fd == SSH_INVALID_SOCKET) {
return -1;
}
@@ -912,7 +912,7 @@ int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bin
return SSH_ERROR;
fd=ssh_connect_host_nonblocking(s->session,host,bind_addr,port);
ssh_log(session,SSH_LOG_PROTOCOL,"Nonblocking connection socket: %d",fd);
- if(fd < 0)
+ if(fd == SSH_INVALID_SOCKET)
return SSH_ERROR;
ssh_socket_set_fd(s,fd);
s->state=SSH_SOCKET_CONNECTING;