From 51c2a23373ee3583682e6faae3dc4f518bd03f04 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 23 Aug 2010 09:35:43 +0200 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ lib/poll.c | 2 ++ lib/select.c | 2 ++ 3 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1337347344..7a0851099b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-08-22 Paolo Bonzini + Erik Faye-Lund + + 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 fts: allow compilation with C++ diff --git a/lib/poll.c b/lib/poll.c index 49c41591ef..aeb7a356fc 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 5677fdd478..bc02266428 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 { -- 2.30.2