Repository : ssh://darcs.haskell.org//srv/darcs/packages/base On branch : ghc-7.4
http://hackage.haskell.org/trac/ghc/changeset/bd399cef9d91060a3d733be4c18cb901a2efbbc8 >--------------------------------------------------------------- commit bd399cef9d91060a3d733be4c18cb901a2efbbc8 Author: Paolo Capriotti <[email protected]> Date: Tue Mar 27 16:37:06 2012 +0100 Ensure hGetBufSome does not cause potentially blocking reads (#5843) When there is data in a handle buffer, never fetch more than the available number of elements, since that can cause a blocking read on Windows. MERGED from commit 370fc0b455f6a03283fbd5c0baa5d08d9115379d >--------------------------------------------------------------- GHC/IO/Handle/Text.hs | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/GHC/IO/Handle/Text.hs b/GHC/IO/Handle/Text.hs index 280cebd..3eedae6 100644 --- a/GHC/IO/Handle/Text.hs +++ b/GHC/IO/Handle/Text.hs @@ -889,7 +889,8 @@ hGetBufSome h ptr count -- that bufReadNBNonEmpty will not -- issue another read. else - bufReadNBNonEmpty h_ buf (castPtr ptr) 0 count + let count' = min count (bufferElems buf) + in bufReadNBNonEmpty h_ buf (castPtr ptr) 0 count' haFD :: Handle__ -> FD haFD h_@Handle__{..} = _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
