use WSAGetLastError() for errno on Windows

This commit is contained in:
Yasuhiro Matsumoto
2022-10-28 17:10:00 +09:00
parent 6b2f08d933
commit fd5e3654c4
+5
View File
@@ -1258,8 +1258,13 @@ mrb_io_s_select(mrb_state *mrb, mrb_value klass)
retry:
n = select(max, rp, wp, ep, tp);
if (n < 0) {
#ifdef _WIN32
if (WSAGetLastError() != WSAEINTR)
mrb_sys_fail(mrb, "select failed");
#else
if (errno != EINTR)
mrb_sys_fail(mrb, "select failed");
#endif
if (tp == NULL)
goto retry;
interrupt_flag = 1;