getcwd: Work around getcwd bug on AIX 5..7.
[gnulib.git] / lib / select.c
index 773689c..aee0ac2 100644 (file)
@@ -1,7 +1,7 @@
 /* Emulation for select(2)
    Contributed by Paolo Bonzini.
 
-   Copyright 2008-2010 Free Software Foundation, Inc.
+   Copyright 2008-2011 Free Software Foundation, Inc.
 
    This file is part of gnulib.
 
@@ -27,7 +27,6 @@
 /* Native Win32.  */
 
 #include <sys/types.h>
-#include <stdbool.h>
 #include <errno.h>
 #include <limits.h>
 
@@ -38,6 +37,8 @@
 #include <conio.h>
 #include <time.h>
 
+#include "msvc-nothrow.h"
+
 struct bitset {
   unsigned char in[FD_SETSIZE / CHAR_BIT];
   unsigned char out[FD_SETSIZE / CHAR_BIT];
@@ -132,6 +133,8 @@ win32_poll_handle (HANDLE h, int fd, struct bitset *rbits, struct bitset *wbits,
           if (avail)
             read = TRUE;
         }
+      else if (GetLastError () == ERROR_BROKEN_PIPE)
+        ;
 
       else
         {
@@ -246,7 +249,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
     wait_timeout = INFINITE;
   else
     {
-      wait_timeout = timeout->tv_sec + timeout->tv_usec / 1000;
+      wait_timeout = timeout->tv_sec * 1000 + timeout->tv_usec / 1000;
 
       /* select is also used as a portable usleep.  */
       if (!rfds && !wfds && !xfds)