summaryrefslogtreecommitdiffstats
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 7d5fbda63..ece432f0b 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -4367,7 +4367,9 @@ rb_w32_read(int fd, void *buf, size_t size)
if (pol) {
wait = rb_w32_wait_events_blocking(&ol.hEvent, 1, INFINITE);
if (wait != WAIT_OBJECT_0) {
- if (errno != EINTR)
+ if (wait == WAIT_OBJECT_0 + 1)
+ errno = EINTR;
+ else
errno = map_errno(GetLastError());
CloseHandle(ol.hEvent);
cancel_io((HANDLE)_osfhnd(fd));
@@ -4471,7 +4473,9 @@ rb_w32_write(int fd, const void *buf, size_t size)
if (pol) {
wait = rb_w32_wait_events_blocking(&ol.hEvent, 1, INFINITE);
if (wait != WAIT_OBJECT_0) {
- if (errno != EINTR)
+ if (wait == WAIT_OBJECT_0 + 1)
+ errno = EINTR;
+ else
errno = map_errno(GetLastError());
CloseHandle(ol.hEvent);
cancel_io((HANDLE)_osfhnd(fd));