From 1fdef50f529b722d13059db4d641359dbf9f1647 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Fri, 19 Jul 2019 10:55:28 +0200 Subject: [PATCH] src/pxar/sequential_decoder.rs: Call callback only on restored paths. Signed-off-by: Christian Ebner --- src/pxar/sequential_decoder.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pxar/sequential_decoder.rs b/src/pxar/sequential_decoder.rs index 89aa46bb..79ae2d53 100644 --- a/src/pxar/sequential_decoder.rs +++ b/src/pxar/sequential_decoder.rs @@ -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),