summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 72ca08f55e..a4cea9b287 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1811,7 +1811,12 @@ rb_w32_fdclr(int fd, fd_set *set)
int
rb_w32_fdisset(int fd, fd_set *set)
{
- return __WSAFDIsSet(TO_SOCKET(fd), set);
+ int ret;
+ SOCKET s = TO_SOCKET(fd);
+ if (s == (SOCKET)INVALID_HANDLE_VALUE)
+ return 0;
+ RUBY_CRITICAL(ret = __WSAFDIsSet(s, set));
+ return ret;
}
//