fix bug in partial writes
authorSimon Marlow <marlowsd@gmail.com>
Tue, 23 Jun 2009 10:50:04 +0000 (10:50 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Tue, 23 Jun 2009 10:50:04 +0000 (10:50 +0000)
GHC/IO/FD.hs

index 76c0242..44490fb 100644 (file)
@@ -398,7 +398,7 @@ fdWrite fd ptr bytes = do
   res <- writeRawBufferPtr "GHC.IO.FD.fdWrite" fd ptr 0 (fromIntegral bytes)
   let res' = fromIntegral res
   if res' < bytes 
-     then fdWrite fd (ptr `plusPtr` bytes) (bytes - res')
+     then fdWrite fd (ptr `plusPtr` res') (bytes - res')
      else return ()
 
 -- XXX ToDo: this isn't non-blocking