summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-11-13 10:20:27 +0000
committerSimon MacMullen <simon@rabbitmq.com>2014-11-13 10:20:27 +0000
commit16b013458097e1a9a7d20f0138c24f705a8251f3 (patch)
tree55e93a5ba4a44df9a08f23dee2f30235f63455bf
parentb2f148b473f1ac50c17b52e95dd2b1ae52958c74 (diff)
downloadrabbitmq-server-16b013458097e1a9a7d20f0138c24f705a8251f3.tar.gz
If they ask to read more than the buffer size, do so.
-rw-r--r--src/file_handle_cache.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl
index 519c596d..a7d5ce15 100644
--- a/src/file_handle_cache.erl
+++ b/src/file_handle_cache.erl
@@ -346,11 +346,11 @@ read(Ref, Count) ->
read_buffer_size = BufSz - Count}]};
([Handle = #handle{read_buffer = Buf,
read_buffer_size = BufSz,
- read_buffer_size_limit = Limit,
+ read_buffer_size_limit = BufSzLimit,
hdl = Hdl,
offset = Offset}]) ->
WantedCount = Count - BufSz,
- case prim_file_read(Hdl, Limit) of
+ case prim_file_read(Hdl, lists:max([BufSzLimit, WantedCount])) of
{ok, Data} ->
ReadCount = size(Data),
case ReadCount < WantedCount of