summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/socket.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1999-02-24 16:01:16 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1999-02-24 16:01:16 +0000
commit0b11fd35473a123c38e0f22b1efc852f79c26791 (patch)
tree0b4db392a97fbabc724c7425dab735ae7e0cd113 /otherlibs/win32unix/socket.c
parent5038f3cdb6377dfc84e4642b710c1a1949060e1d (diff)
Sockets asynchrones, suite
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2305 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/socket.c')
-rw-r--r--otherlibs/win32unix/socket.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/otherlibs/win32unix/socket.c b/otherlibs/win32unix/socket.c
index c543bcf88..5e8d218ec 100644
--- a/otherlibs/win32unix/socket.c
+++ b/otherlibs/win32unix/socket.c
@@ -28,10 +28,11 @@ value unix_socket(domain, type, proto, synchronous) /* ML */
value domain, type, proto;
{
SOCKET s;
- int oldvalue, newvalue, retcode;
+ int oldvalue, oldvaluelen, newvalue, retcode;
+ oldvaluelen = sizeof(oldvalue);
retcode = getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
- (char *) &oldvalue, sizeof(oldvalue));
+ (char *) &oldvalue, &oldvaluelen);
if (retcode == 0) {
/* Set sockets to synchronous or asnychronous mode, as requested */
newvalue = Bool_val(synchronous) ? SO_SYNCHRONOUS_NONALERT : 0;
@@ -44,7 +45,7 @@ value unix_socket(domain, type, proto, synchronous) /* ML */
if (retcode == 0) {
/* Restore initial mode */
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
- (char *) &oldvalue, sizeof(oldvalue));
+ (char *) &oldvalue, oldvaluelen);
}
if (s == INVALID_SOCKET) unix_error(WSAGetLastError(), "socket", Nothing);
return win_alloc_handle((HANDLE) s);