[MLton-commit] r4682

Stephen Weeks MLton@mlton.org
Thu, 13 Jul 2006 14:31:52 -0700


Fixed bug that incorrectly computed the optlen argument to
setsockopt.  When converting a precision to a number of bytes, one
should divide by 8, not 4.

This had caused the echo regression test to fail on Solaris.


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

U   mlton/branches/on-20050822-x86_64-branch/basis-library/net/socket.sml

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

Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/net/socket.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library/net/socket.sml	2006-07-13 19:19:16 UTC (rev 4681)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library/net/socket.sml	2006-07-13 21:31:51 UTC (rev 4682)
@@ -88,8 +88,10 @@
       type optvalVec = Word8.word vector
       type optvalArr = Word8.word array
 
+      val bitsPerByte = 8
+         
       val isBigEndian = Primitive.MLton.Platform.Arch.hostIsBigEndian
-      val intLen = Int.quot (C_Int.precision', 4)
+      val intLen = Int.quot (C_Int.precision', bitsPerByte)
       fun unmarshalInt (wa: optvalArr) : C_Int.int =
          let
             fun loop (i, acc) =
@@ -133,7 +135,7 @@
          if (unmarshalInt wa) = 0 then false else true
       fun marshalBool (b: bool) : optvalVec = 
          marshalInt (if b then 1 else 0)
-      val sizeLen = Int.quot (C_Size.wordSize, 4)
+      val sizeLen = Int.quot (C_Size.wordSize, bitsPerByte)
       fun unmarshalSize (wa: optvalArr) : int =
          let
             fun loop (i, acc) =