From ed8788054ed764f873d43a88fd3ea4ab74373dc1 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 27 Oct 2010 14:43:24 +0000 Subject: [PATCH] hGetBuf: fix a case of a short read being returned (#4427) --- GHC/IO/Handle/Text.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GHC/IO/Handle/Text.hs b/GHC/IO/Handle/Text.hs index ebb29c8..cf2541f 100644 --- a/GHC/IO/Handle/Text.hs +++ b/GHC/IO/Handle/Text.hs @@ -861,7 +861,7 @@ bufReadEmpty h_@Handle__{..} bufReadNonEmpty h_ buf' ptr so_far count where loop :: FD -> Int -> Int -> IO Int - loop fd off bytes | bytes <= 0 = return off + loop fd off bytes | bytes <= 0 = return (so_far + off) loop fd off bytes = do r <- RawIO.read (fd::FD) (ptr `plusPtr` off) (fromIntegral bytes) if r == 0 -- 1.7.10.4