[MLton-commit] r7197

Wesley Terpstra wesley at mlton.org
Tue Jun 30 15:44:19 PDT 2009


The fd_modify function was clearing the errno status.

This was particularly troublesome since it means that non-blocking I/O 
appears to succeed even when it in fact fails with EAGAIN status.


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

U   mlton/trunk/runtime/platform/recv.nonblock.c

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

Modified: mlton/trunk/runtime/platform/recv.nonblock.c
===================================================================
--- mlton/trunk/runtime/platform/recv.nonblock.c	2009-06-30 22:37:25 UTC (rev 7196)
+++ mlton/trunk/runtime/platform/recv.nonblock.c	2009-06-30 22:44:15 UTC (rev 7197)
@@ -2,9 +2,13 @@
 
 static void fd_modify(int fd, int flags, int add, int shouldRemove)
 {
+        int status;
+        
         if (flags & MSG_DONTWAIT) {
+                status = errno;
                 int f = fcntl(fd, F_GETFL);
                 fcntl(fd, F_SETFL, (f | add) & ~shouldRemove);
+                errno = status;
         }
 }
 




More information about the MLton-commit mailing list