poll, select: handle ERROR_BROKEN_PIPE.
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 23 Aug 2010 07:35:43 +0000 (09:35 +0200)
committerIan Beckwith <ianb@erislabs.net>
Sun, 29 Aug 2010 16:18:56 +0000 (17:18 +0100)
* lib/poll.c (win32_compute_revents): Return POLLHUP when
PeekNamedPipe fails with ERROR_BROKEN_PIPE.
* lib/select.c (win32_compute_revents): Do not mark a pipe
as writeable if PeekNamedPipe fails with ERROR_BROKEN_PIPE.
(cherry picked from commit 51c2a23373ee3583682e6faae3dc4f518bd03f04)

ChangeLog
lib/poll.c
lib/select.c

index 1337347..7a08510 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-22  Paolo Bonzini  <bonzini@gnu.org>
+           Erik Faye-Lund <kusmabite@gmail.com>
+
+       poll, select: handle ERROR_BROKEN_PIPE.
+       * lib/poll.c (win32_compute_revents): Return POLLHUP when
+       PeekNamedPipe fails with ERROR_BROKEN_PIPE.
+       * lib/select.c (win32_compute_revents): Do not mark a pipe
+       as writeable if PeekNamedPipe fails with ERROR_BROKEN_PIPE.
+
 2010-08-22  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        fts: allow compilation with C++
index 49c4159..aeb7a35 100644 (file)
@@ -150,6 +150,8 @@ win32_compute_revents (HANDLE h, int *p_sought)
           if (avail)
             happened |= *p_sought & (POLLIN | POLLRDNORM);
         }
+      else if (GetLastError () == ERROR_BROKEN_PIPE)
+        happened |= POLLHUP;
 
       else
         {
index 5677fdd..bc02266 100644 (file)
@@ -132,6 +132,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
         {