pxar/create: fix endless loop for shrinking files

when a file shrunk during backup, we endlessly looped, reading/copying 0 bytes
we already have code that handles shrunk files, but we forgot to
break from the read loop

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-11-05 09:17:43 +01:00 committed by Wolfgang Bumiller
parent 9d79cec4d5
commit 91e3b38da4
1 changed files with 2 additions and 0 deletions

View File

@ -661,6 +661,8 @@ impl<'a, 'b> Archiver<'a, 'b> {
if got as u64 > remaining {
self.report_file_grew_while_reading()?;
got = remaining as usize;
} else if got == 0 {
break; // we reached eof
}
out.write_all(&self.file_copy_buffer[..got])?;
remaining -= got as u64;