changeset 13565:69913822a0f7

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.
author Paolo Bonzini <pbonzini@redhat.com>
date Mon, 23 Aug 2010 09:35:43 +0200
parents 1b02c6324dca
children 51a6350100fa
files ChangeLog lib/poll.c lib/select.c
diffstat 3 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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++
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -150,6 +150,8 @@
           if (avail)
             happened |= *p_sought & (POLLIN | POLLRDNORM);
         }
+      else if (GetLastError () == ERROR_BROKEN_PIPE)
+        happened |= POLLHUP;
 
       else
         {
--- a/lib/select.c
+++ b/lib/select.c
@@ -132,6 +132,8 @@
           if (avail)
             read = TRUE;
         }
+      else if (GetLastError () == ERROR_BROKEN_PIPE)
+        ;
 
       else
         {