pxar/create: handle ErrorKind::Interrupted for file reads

they are not an error and we should retry the read

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:29:06 +01:00 committed by Wolfgang Bumiller
parent 91e3b38da4
commit 3c2dd8ad05
1 changed files with 5 additions and 1 deletions

View File

@ -657,7 +657,11 @@ impl<'a, 'b> Archiver<'a, 'b> {
let mut remaining = file_size;
let mut out = encoder.create_file(metadata, file_name, file_size)?;
while remaining != 0 {
let mut got = file.read(&mut self.file_copy_buffer[..])?;
let mut got = match file.read(&mut self.file_copy_buffer[..]) {
Ok(got) => got,
Err(err) if err.kind() == std::io::ErrorKind::Interrupted => continue,
Err(err) => bail!(err),
};
if got as u64 > remaining {
self.report_file_grew_while_reading()?;
got = remaining as usize;