Package: libssh / 0.4.5-3+squeeze3

0001-socket.c-Fixed-setting-max_fd-which-breaks-ssh_selec.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From: Vic Lee <llyzs@163.com>
Date: Mon, 20 Sep 2010 16:32:08 +0000
Subject: [PATCH] socket.c: Fixed setting max_fd which breaks ssh_select().

Signed-off-by: Andreas Schneider <asn@cynapses.org>
---
 libssh/socket.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libssh/socket.c b/libssh/socket.c
index 402a5b7..02db660 100644
--- a/libssh/socket.c
+++ b/libssh/socket.c
@@ -257,7 +257,10 @@ void ssh_socket_fd_set(struct socket *s, fd_set *set, socket_t *max_fd) {
   if (s->fd == SSH_INVALID_SOCKET)
     return;
   FD_SET(s->fd,set);
-  if (s->fd >= 0 && s->fd != SSH_INVALID_SOCKET) {
+
+  if (s->fd >= 0 &&
+      s->fd >= *max_fd &&
+      s->fd != SSH_INVALID_SOCKET) {
     *max_fd = s->fd + 1;
   }
 }
--