Daniel P. Berrange wrote: > Perhaps I'm mis-understanding, but I was looking at this code: > > h = (HANDLE) _get_osfhandle (pfd[i].fd); > assure (h != NULL); > if (IsSocketHandle (h)) > { > int requested = FD_CLOSE; > > /* see above; socket handles are mapped onto select. */ > if (sought & (POLLIN | POLLRDNORM)) > { > requested |= FD_READ | FD_ACCEPT; > FD_SET ((SOCKET) h, &rfds); > } > if (sought & (POLLOUT | POLLWRNORM | POLLWRBAND)) > { > requested |= FD_WRITE | FD_CONNECT; > FD_SET ((SOCKET) h, &wfds); > } > if (sought & (POLLPRI | POLLRDBAND)) > { > requested |= FD_OOB; > FD_SET ((SOCKET) h, &xfds); > } > > which takes the 'FD' and gets the associated SOCKET / HANDLE. > The 'xfds' fd_set is thus populated with a SOCKET, not a FD.
You're perfectly right. I misread the code. I'm applying this: 2017-05-11 Bruno Haible <br...@clisp.org> poll: Fix confusion between SOCKETs and FDs on native Windows. Fix proposed by Daniel P. Berrange <berra...@redhat.com>. * lib/poll.c [WINDOWS_NATIVE]: Undefine select. diff --git a/lib/poll.c b/lib/poll.c index c4b2127..818a2cd 100644 --- a/lib/poll.c +++ b/lib/poll.c @@ -80,6 +80,10 @@ first argument, not any possible gnulib override. */ # undef recv +/* Here we need the select() function from Windows, because we pass bit masks + of SOCKETs, not bit masks of FDs. */ +# undef select + static BOOL IsConsoleHandle (HANDLE h) { DWORD mode;