Mercurial > hg > octave-nkf > gnulib-hg
changeset 17702:77be5ed9d74f
select,poll: fix console handle check on windows 8
Similarly to commit a008d625 which fixed the obvious
problem with isatty(), also apply the fix to the
select() and poll() MS-Windows implementations.
lib/poll.c (IsConsoleHandle): Change from testing the lower
2 bits of the handle to the more expensive but accurate syscall.
lib/select.c: Likewise.
author | Pádraig Brady <P@draigBrady.com> |
---|---|
date | Tue, 10 Jun 2014 23:31:39 +0100 |
parents | e41f2cd61471 |
children | ba9e9026f860 |
files | ChangeLog lib/poll.c lib/select.c |
diffstat | 3 files changed, 17 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-06-10 Pádraig Brady <P@draigBrady.com> + + select,poll: fix console handle check on windows 8 + lib/poll.c (IsConsoleHandle): Change from testing the lower + 2 bits of the handle to the more expensive but accurate syscall. + lib/select.c: Likewise. + 2014-06-10 Eli Zaretskii <eliz@gnu.org> select: fix waiting on anonymous pipes on MS-Windows
--- a/lib/poll.c +++ b/lib/poll.c @@ -70,9 +70,11 @@ #ifdef WINDOWS_NATIVE -/* Optimized test whether a HANDLE refers to a console. - See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>. */ -#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3) +static BOOL IsConsoleHandle (HANDLE h) +{ + DWORD mode; + return GetConsoleMode (h, &mode) != 0; +} static BOOL IsSocketHandle (HANDLE h)
--- a/lib/select.c +++ b/lib/select.c @@ -82,9 +82,11 @@ #define PIPE_BUF 512 #endif -/* Optimized test whether a HANDLE refers to a console. - See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>. */ -#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3) +static BOOL IsConsoleHandle (HANDLE h) +{ + DWORD mode; + return GetConsoleMode (h, &mode) != 0; +} static BOOL IsSocketHandle (HANDLE h)