Close the writer on flush

This commit is contained in:
Mathijs van de Nes 2015-02-24 19:06:19 +01:00
parent 51c55d30b3
commit b4ccb46389

View file

@ -79,7 +79,9 @@ impl<W: Write+io::Seek> Write for ZipWriter<W>
fn flush(&mut self) -> io::Result<()>
{
match self.finalize() {
let result = self.finalize();
self.inner = GenericZipWriter::Closed;
match result {
Ok(..) => Ok(()),
Err(ZipError::Io(io_err)) => Err(io_err),
Err(..) => Err(io::Error::new(io::ErrorKind::Other, "Error occured during finalization", None)),