bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] poll, select: handle ERROR_BROKEN_PIPE.


From: Paolo Bonzini
Subject: [PATCH] poll, select: handle ERROR_BROKEN_PIPE.
Date: Mon, 23 Aug 2010 09:46:31 +0200

Hi Erik, this is what I'm applying.

* 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    |    9 +++++++++
 lib/poll.c   |    2 ++
 lib/select.c |    2 ++
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1337347..7a08510 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-08-22  Paolo Bonzini  <address@hidden>
+           Erik Faye-Lund <address@hidden>
+
+       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  <address@hidden>
 
        fts: allow compilation with C++
diff --git a/lib/poll.c b/lib/poll.c
index 49c4159..aeb7a35 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -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
         {
diff --git a/lib/select.c b/lib/select.c
index 5677fdd..bc02266 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -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
         {
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]