2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-01-30 09:15:33 +00:00

Merge pull request #802 from jerry73204/fix-reading-buf-bug

This commit is contained in:
Friedel Ziegelmayer 2020-05-29 13:32:48 +02:00 committed by GitHub
commit 0ec027dbff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -673,7 +673,7 @@ impl LockGuard<State> {
if available > 0 || self.cache.is_empty() {
// Copy data from the cache into the buffer.
let n = cmp::min(available, buf.len());
buf[..n].copy_from_slice(&self.cache[start..n]);
buf[..n].copy_from_slice(&self.cache[start..(start + n)]);
// Move the read cursor forward.
self.mode = Mode::Reading(start + n);