From 8bdeb78f06b7013b6eedf2deeedf68462c18a5b4 Mon Sep 17 00:00:00 2001 From: ArvidNorr Date: Mon, 14 Jan 2013 02:12:30 -0800 Subject: [PATCH] Wrong max socket value fix --- libfreerdp/utils/tcp.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libfreerdp/utils/tcp.c b/libfreerdp/utils/tcp.c index 83e125d79..90e65415d 100644 --- a/libfreerdp/utils/tcp.c +++ b/libfreerdp/utils/tcp.c @@ -182,10 +182,14 @@ int freerdp_tcp_write(int sockfd, BYTE* data, int length) int freerdp_tcp_wait_read(int sockfd) { fd_set fds; - + if(sockfd<1) + { + printf("Invalid socket to watch: %d\n",sockfd); + return 0 ; + } FD_ZERO(&fds); FD_SET(sockfd, &fds); - select(1, &fds, NULL, NULL, NULL); + select(sockfd+1, &fds, NULL, NULL, NULL); return 0; } @@ -193,10 +197,15 @@ int freerdp_tcp_wait_read(int sockfd) int freerdp_tcp_wait_write(int sockfd) { fd_set fds; + if(sockfd<1) + { + printf("Invalid socket to watch: %d\n",sockfd); + return 0; + } FD_ZERO(&fds); FD_SET(sockfd, &fds); - select(1, NULL, &fds, NULL, NULL); + select(sockfd+1, NULL, &fds, NULL, NULL); return 0; }