Skip to content

Commit

Permalink
Fix up check to bypass internal buffer
Browse files Browse the repository at this point in the history
We don't care about how much space the allocation has, but the actual
usable space in the buffer.
  • Loading branch information
sfackler committed Jan 29, 2015
1 parent c5961ad commit 26276f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/old_io/buffered.rs
Expand Up @@ -111,7 +111,7 @@ impl<R: Reader> Buffer for BufferedReader<R> {

impl<R: Reader> Reader for BufferedReader<R> {
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
if self.pos == self.cap && buf.len() >= self.buf.capacity() {
if self.pos == self.cap && buf.len() >= self.buf.len() {
return self.inner.read(buf);
}
let nread = {
Expand Down

0 comments on commit 26276f4

Please sign in to comment.