src/pxar/sequential_decoder.rs: Call callback only on restored paths.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-07-19 10:55:28 +02:00 committed by Dietmar Maurer
parent 40a13369a3
commit 1fdef50f52

View File

@ -697,13 +697,12 @@ impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F
) -> Result<(), Error> {
let full_path = base_path.join(&relative_path);
(self.callback)(&full_path)?;
let head: CaFormatHeader = self.read_item()?;
if head.htype == PXAR_FORMAT_HARDLINK {
let (target, _offset) = self.read_hardlink(head.size)?;
let target_path = base_path.join(&target);
if let Some(_) = parent_fd {
(self.callback)(&full_path)?;
hardlink(&target_path, &full_path)?;
}
return Ok(());
@ -726,6 +725,10 @@ impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F
}
}
if fd.is_some() {
(self.callback)(&full_path)?;
}
match entry.mode as u32 & libc::S_IFMT {
libc::S_IFDIR => self.restore_dir_sequential(base_path, relative_path, &full_path, fd, &entry, &filename, &child_pattern),
libc::S_IFLNK => self.restore_symlink(fd, &full_path, &entry, &filename),