src/pxar/decoder.rs: correctly handle hardlinks in `Decoder`s attribute function

If the attributes are then returned by seeking to the new offset.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-09-09 18:27:25 +02:00 committed by Dietmar Maurer
parent d00097a0e6
commit 1443927c02
1 changed files with 7 additions and 0 deletions

View File

@ -306,6 +306,13 @@ impl<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<R, F> {
let _filename = self.inner.read_filename(size)?; let _filename = self.inner.read_filename(size)?;
marker = self.inner.read_item()?; marker = self.inner.read_item()?;
} }
if marker == PXAR_FORMAT_HARDLINK {
let size: u64 = self.inner.read_item()?;
let (_, diff) = self.inner.read_hardlink(size)?;
return self.attributes(offset - diff);
}
if marker != PXAR_ENTRY { if marker != PXAR_ENTRY {
bail!("Expected PXAR_ENTRY, found 0x{:x?}", marker); bail!("Expected PXAR_ENTRY, found 0x{:x?}", marker);
} }