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:
parent
40a13369a3
commit
1fdef50f52
|
@ -697,13 +697,12 @@ impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let full_path = base_path.join(&relative_path);
|
let full_path = base_path.join(&relative_path);
|
||||||
|
|
||||||
(self.callback)(&full_path)?;
|
|
||||||
|
|
||||||
let head: CaFormatHeader = self.read_item()?;
|
let head: CaFormatHeader = self.read_item()?;
|
||||||
if head.htype == PXAR_FORMAT_HARDLINK {
|
if head.htype == PXAR_FORMAT_HARDLINK {
|
||||||
let (target, _offset) = self.read_hardlink(head.size)?;
|
let (target, _offset) = self.read_hardlink(head.size)?;
|
||||||
let target_path = base_path.join(&target);
|
let target_path = base_path.join(&target);
|
||||||
if let Some(_) = parent_fd {
|
if let Some(_) = parent_fd {
|
||||||
|
(self.callback)(&full_path)?;
|
||||||
hardlink(&target_path, &full_path)?;
|
hardlink(&target_path, &full_path)?;
|
||||||
}
|
}
|
||||||
return Ok(());
|
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 {
|
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_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),
|
libc::S_IFLNK => self.restore_symlink(fd, &full_path, &entry, &filename),
|
||||||
|
|
Loading…
Reference in New Issue