diff options
Diffstat (limited to 'otherlibs/win32unix/select.c')
-rw-r--r-- | otherlibs/win32unix/select.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/otherlibs/win32unix/select.c b/otherlibs/win32unix/select.c index 4fa8e788b..a7b68217e 100644 --- a/otherlibs/win32unix/select.c +++ b/otherlibs/win32unix/select.c @@ -54,6 +54,7 @@ CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value int retcode; value res; value read_list = Val_unit, write_list = Val_unit, except_list = Val_unit; + DWORD errcode = 0; Begin_roots3 (readfds, writefds, exceptfds) Begin_roots3 (read_list, write_list, except_list) @@ -79,10 +80,11 @@ CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value tvp = &tv; } enter_blocking_section(); - retcode = select(FD_SETSIZE, &read, &write, &except, tvp); + if (select(FD_SETSIZE, &read, &write, &except, tvp) == -1) + errcode = WSAGetLastError(); leave_blocking_section(); - if (retcode == -1) { - win32_maperr(WSAGetLastError()); + if (errcode) { + win32_maperr(errcode); uerror("select", Nothing); } read_list = fdset_to_fdlist(readfds, &read); |