summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/socket.c
diff options
context:
space:
mode:
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);