Commit 077ba3c2 authored by pcapriotti's avatar pcapriotti
Browse files

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
parent 86330a32
......@@ -889,7 +889,8 @@ hGetBufSome h ptr count
-- that bufReadNBNonEmpty will not
-- issue another read.
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__{..} =
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment