input/nfs: never read more than space available in buffer
Avoids off-by-one bug and obsoletes the bug fix in commit 966c4244
This commit is contained in:
parent
936eb43c0e
commit
3e4e6f7ced
@ -93,12 +93,14 @@ NfsInputStream::DoRead()
|
||||
if (remaining <= 0)
|
||||
return true;
|
||||
|
||||
if (IsBufferFull()) {
|
||||
const size_t buffer_space = GetBufferSpace();
|
||||
if (buffer_space == 0) {
|
||||
Pause();
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t nbytes = std::min<uint64_t>(remaining, 32768);
|
||||
size_t nbytes = std::min<size_t>(std::min<uint64_t>(remaining, 32768),
|
||||
buffer_space);
|
||||
|
||||
mutex.unlock();
|
||||
Error error;
|
||||
|
Loading…
Reference in New Issue
Block a user