summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/accept.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2003-01-06 16:44:21 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2003-01-06 16:44:21 +0000
commit424b9cf4d40da771f4d7bf346c9b95a7f272c235 (patch)
treeaa9127b10231cc937e7dc8ea8099fa907a61688b /otherlibs/win32unix/accept.c
parentca7ebc2e5fc64690b2e92f7567453723fd464abc (diff)
Ajout {set,clear}_nonblock. Cas special Unix.select lorsque les 3 listes de descripteurs sont vides. Correction bug traitement d'erreur dans Unix.accept. PR#1499
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5375 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/accept.c')
-rw-r--r--otherlibs/win32unix/accept.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/otherlibs/win32unix/accept.c b/otherlibs/win32unix/accept.c
index fdac3e5da..ec7068bd3 100644
--- a/otherlibs/win32unix/accept.c
+++ b/otherlibs/win32unix/accept.c
@@ -29,6 +29,7 @@ CAMLprim value unix_accept(sock)
int oldvalue, oldvaluelen, newvalue, retcode;
union sock_addr_union addr;
socklen_param_type addr_len;
+ int errcode = 0;
oldvaluelen = sizeof(oldvalue);
retcode = getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
@@ -43,13 +44,15 @@ CAMLprim value unix_accept(sock)
enter_blocking_section();
snew = accept(sconn, &addr.s_gen, &addr_len);
leave_blocking_section();
+ if( snew == INVALID_SOCKET )
+ errcode = WSAGetLastError ();
if (retcode == 0) {
/* Restore initial mode */
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
(char *) &oldvalue, oldvaluelen);
}
if (snew == INVALID_SOCKET) {
- win32_maperr(WSAGetLastError());
+ win32_maperr(errcode);
uerror("accept", Nothing);
}
Begin_roots2 (fd, adr)