OSDN Git Service

* select.cc (cygwin_select): Make sure that 0 is returned when sel.wait times
authorcgf <cgf>
Thu, 8 Dec 2011 20:24:33 +0000 (20:24 +0000)
committercgf <cgf>
Thu, 8 Dec 2011 20:24:33 +0000 (20:24 +0000)
out.

winsup/cygwin/ChangeLog
winsup/cygwin/select.cc

index b16708e..7bcb6e3 100644 (file)
@@ -1,5 +1,10 @@
 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
 
+       * select.cc (cygwin_select): Make sure that 0 is returned when sel.wait
+       times out.
+
+2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
        * include/sys/wait.h: Add in all c++ functions.
 
 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
index 242a160..e87e639 100644 (file)
@@ -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,