poll, select: handle ERROR_BROKEN_PIPE.
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 23 Aug 2010 07:35:43 +0000 (09:35 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 23 Aug 2010 07:48:16 +0000 (09:48 +0200)
* 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.

ChangeLog
lib/poll.c
lib/select.c

index 1337347344bc6a0bcac09078205534fb3e165b12..7a0851099b59082e6cd82355e5573601f08433d6 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 49c41591efee5f1bd556f1811245f494710668cd..aeb7a356fcbd05043f2c1523e5eaea725a577867 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 5677fdd478f0e1fdb7f2dbf94351d6ccec1c2985..bc0226642827aedf012cec20bc05794d25fed533 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
         {