[MLton-commit] r5481

Matthew Fluet fluet at mlton.org
Thu Mar 29 08:10:00 PST 2007


Patch from Nicolas Bertolotti (PolySpace).

- bug-fix-closesocket-mingw.patch

This patch fixes the Socket.close() function on MinGW. On Windows, a socket
should be closed using the "closesocket" function rather than the "close"
function.


----------------------------------------------------------------------

U   mlton/trunk/runtime/basis/Net/Socket/Socket.c

----------------------------------------------------------------------

Modified: mlton/trunk/runtime/basis/Net/Socket/Socket.c
===================================================================
--- mlton/trunk/runtime/basis/Net/Socket/Socket.c	2007-03-29 14:59:46 UTC (rev 5480)
+++ mlton/trunk/runtime/basis/Net/Socket/Socket.c	2007-03-29 16:09:59 UTC (rev 5481)
@@ -11,7 +11,11 @@
 }
 
 C_Errno_t(C_Int_t) Socket_close(C_Sock_t s) {
+#ifdef __MINGW32__
+  return closesocket(s);
+#else
   return close(s);
+#endif
 }
 
 C_Errno_t(C_Int_t) Socket_connect (C_Sock_t s, Vector(Word8_t) addr, C_Socklen_t addrlen) {




More information about the MLton-commit mailing list