[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] poll: fix regression in Win32 emulation of poll function
From: |
Bruno Haible |
Subject: |
Re: [PATCH] poll: fix regression in Win32 emulation of poll function |
Date: |
Thu, 11 May 2017 15:15:46 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-75-generic; KDE/5.18.0; x86_64; ; ) |
Hi Daniel,
> it does not actually make poll() function correctly. We're still passing
> HANDLE objects to the rpl_select() method, instead of calling
> the native select() method.
I don't agree with your reasoning. The select() calls in lib/poll.c:511 and
lib/poll.c:547 is not passing a HANDLE, rather it passes bit masks of FDs
that correspond to SOCKETs. Therefore I propose this patch:
diff --git a/lib/poll.c b/lib/poll.c
index c4b2127..2c6e879 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -80,6 +80,14 @@
first argument, not any possible gnulib override. */
# undef recv
+/* Here it does not matter whether we use the select() function from Windows,
+ that works only when all indicated FDs correspond to sockets and that
+ returns its error code in WSAGetLastError(), or the gnulib override that
+ does not have this limitation and that returns its error code in errno.
+ To simplify testing, use the lower-level Windows select() function
+ always. */
+# undef select
+
static BOOL IsConsoleHandle (HANDLE h)
{
DWORD mode;