catar/encoder.rs: make sure we write all data with write_all()

This commit is contained in:
Dietmar Maurer 2019-01-03 15:47:32 +01:00
parent 050f8a6355
commit c7fa487250
1 changed files with 2 additions and 2 deletions

View File

@ -58,13 +58,13 @@ impl <'a, W: Write> CaTarEncoder<'a, W> {
}
fn write(&mut self, buf: &[u8]) -> Result<(), Error> {
self.writer.write(buf)?;
self.writer.write_all(buf)?;
self.writer_pos += buf.len();
Ok(())
}
fn flush_copy_buffer(&mut self, size: usize) -> Result<(), Error> {
self.writer.write(&self.file_copy_buffer[..size])?;
self.writer.write_all(&self.file_copy_buffer[..size])?;
self.writer_pos += size;
Ok(())
}