From 203f97378930be399dcec2b9f5778eb26a482df1 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 8 Dec 2011 20:24:33 +0000 Subject: [PATCH] * select.cc (cygwin_select): Make sure that 0 is returned when sel.wait times out. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/select.cc | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b16708e44..7bcb6e3b4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2011-12-08 Christopher Faylor + + * select.cc (cygwin_select): Make sure that 0 is returned when sel.wait + times out. + 2011-12-08 Christopher Faylor * include/sys/wait.h: Add in all c++ functions. diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 242a1609e..e87e639f6 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -147,12 +147,12 @@ cygwin_select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, break; } else if ((sel.always_ready || ms == 0) - || (res = sel.wait (r, w, e, ms)) == 0) + || (res = sel.wait (r, w, e, ms)) >= 0) { copyfd_set (readfds, r, maxfds); copyfd_set (writefds, w, maxfds); copyfd_set (exceptfds, e, maxfds); - res = sel.poll (readfds, writefds, exceptfds); + res = (res > 0) ? 0 : sel.poll (readfds, writefds, exceptfds); } syscall_printf ("%R = select (%d, %p, %p, %p, %p)", res, maxfds, readfds, -- 2.43.5