aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVic Lee <llyzs@163.com>2010-09-20 19:22:19 +0200
committerAndreas Schneider <asn@cynapses.org>2010-09-20 19:22:19 +0200
commita92545517ab6d57f8725fa53a7efd8ba7f44e916 (patch)
tree2e928269fe19ada610d50e97891eeb888c90b2ed /src
parentfe31fcaeefe2de9ecfb18f2b9df3e6798a4f7a7b (diff)
downloadlibssh-a92545517ab6d57f8725fa53a7efd8ba7f44e916.tar.gz
libssh-a92545517ab6d57f8725fa53a7efd8ba7f44e916.tar.xz
libssh-a92545517ab6d57f8725fa53a7efd8ba7f44e916.zip
socket.c: Fixed setting max_fd which breaks ssh_select().
Signed-off-by: Andreas Schneider <asn@cynapses.org>
Diffstat (limited to 'src')
-rw-r--r--src/socket.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/socket.c b/src/socket.c
index 9d532077..31756da0 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -495,10 +495,14 @@ void ssh_socket_fd_set(ssh_socket s, fd_set *set, socket_t *max_fd) {
FD_SET(s->fd_in,set);
FD_SET(s->fd_out,set);
- if (s->fd_in >= 0 && s->fd_in != SSH_INVALID_SOCKET) {
+ if (s->fd_in >= 0 &&
+ s->fd_in >= *max_fd &&
+ s->fd_in != SSH_INVALID_SOCKET) {
*max_fd = s->fd_in + 1;
}
- if (s->fd_out >= 0 && s->fd_in != SSH_INVALID_SOCKET) {
+ if (s->fd_out >= 0 &&
+ s->fd_out >= *max_fd &&
+ s->fd_out != SSH_INVALID_SOCKET) {
*max_fd = s->fd_out + 1;
}
}