main: fix test_tmr on win32
@@ -766,9 +766,14 @@ static int fd_poll(struct re *re)
return EINVAL;
}
+#ifdef WIN32
+ if (n == SOCKET_ERROR) {
+ return WSAGetLastError();
+ }
+#else
if (n < 0)
return errno;
-
+#endif
/* Check for events */
for (i=0; (n > 0) && (i < re->nfds); i++) {
int fd, flags = 0;
@@ -1014,6 +1019,7 @@ int re_main(re_signal_h *signalh)
break;
}
+
err = fd_poll(re);
if (err) {
if (EINTR == err)
@@ -1023,8 +1029,14 @@ int re_main(re_signal_h *signalh)
/* NOTE: workaround for Darwin */
if (EBADF == err)
continue;
-#endif
+#endif
+#ifdef WIN32
+ if (WSAEINVAL == err) {
+ tmr_poll(&re->tmrl);
+ continue;
+ }
+#endif
break;
}
