File 0005-io-make-use-of-poll-POLLERR-flag.patch of Package ruby2.6

From b75611517f1982f075397152866600cb60673581 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 3 Feb 2020 19:51:55 +0100
Subject: [PATCH 05/12] io: make use of poll POLLERR flag

Return additional array of fds with error.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 include/ruby/io.h | 2 ++
 thread.c          | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/ruby/io.h b/include/ruby/io.h
index 7caca17e3b85..fd3e8e02619f 100644
--- a/include/ruby/io.h
+++ b/include/ruby/io.h
@@ -47,10 +47,12 @@ extern "C" {
 #  define RB_WAITFD_IN  POLLIN
 #  define RB_WAITFD_PRI POLLPRI
 #  define RB_WAITFD_OUT POLLOUT
+#  define RB_WAITFD_ERR (POLLHUP|POLLERR)
 #else
 #  define RB_WAITFD_IN  0x001
 #  define RB_WAITFD_PRI 0x002
 #  define RB_WAITFD_OUT 0x004
+#  define RB_WAITFD_ERR 0x008
 #endif
 
 RUBY_SYMBOL_EXPORT_BEGIN
diff --git a/thread.c b/thread.c
index 50480cf2fb5e..e71ddf4bddc8 100644
--- a/thread.c
+++ b/thread.c
@@ -4242,7 +4242,7 @@ rb_wait_for_single_fd(int fd, int events, struct timeval *timeout)
 
     /* all requested events are ready if there is an error */
     if (fds[0].revents & POLLERR_SET)
-	result |= events;
+	result |= events | POLLERR_SET;
 
     return result;
 }
-- 
2.23.0

openSUSE Build Service is sponsored by