From 2fcaa00e3a919cabf6a246a7c8a216c68394328e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 2 Jan 2008 14:48:48 +0000 Subject: [PATCH] as mentioned in bug #1841442, select wants maxfd+1 in its first argument! --- src/session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/session.c b/src/session.c index 3d33b63..5f4a79e 100644 --- a/src/session.c +++ b/src/session.c @@ -1478,7 +1478,7 @@ libssh2_poll(LIBSSH2_POLLFD * fds, unsigned int nfds, long timeout) struct timeval tv_begin, tv_end; gettimeofday((struct timeval *) &tv_begin, NULL); - sysret = select(maxfd, &rfds, &wfds, NULL, &tv); + sysret = select(maxfd+1, &rfds, &wfds, NULL, &tv); gettimeofday((struct timeval *) &tv_end, NULL); timeout_remaining -= (tv_end.tv_sec - tv_begin.tv_sec) * 1000; @@ -1488,7 +1488,7 @@ libssh2_poll(LIBSSH2_POLLFD * fds, unsigned int nfds, long timeout) /* If the platform doesn't support gettimeofday, * then just make the call non-blocking and walk away */ - sysret = select(maxfd, &rfds, &wfds, NULL, &tv); + sysret = select(maxfd+1, &rfds, &wfds, NULL, &tv); timeout_remaining = 0; #endif