From 6b71351138911ad5435744ebdc87fb72f5ab09c0 Mon Sep 17 00:00:00 2001 From: John Hood Date: Mon, 28 Dec 2015 06:09:11 -0500 Subject: [PATCH] select.h: workaround and report Cygwin select() bug Resolves #705. --- src/util/select.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/util/select.h b/src/util/select.h index 4b4834b..82ffc7b 100644 --- a/src/util/select.h +++ b/src/util/select.h @@ -149,7 +149,15 @@ public: } #endif - if ( ( ret == -1 ) && ( errno == EINTR ) ) { + if ( ret == 0 || ( ret == -1 && errno == EINTR ) ) { + /* Look for and report Cygwin select() bug. */ + if ( ret == 0 ) { + for ( int fd = 0; fd <= max_fd; fd++ ) { + if ( FD_ISSET( fd, &read_fds ) ) { + fprintf( stderr, "select(): nfds = 0 but read fd %d is set\n", fd ); + } + } + } /* The user should process events as usual. */ FD_ZERO( &read_fds ); ret = 0;