pxar: decoder: fix incorrect read for hardlinks.

Decoders read must check if the file is a hardlink and read data from the
corresponding offset if so.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-11-27 16:27:56 +01:00 committed by Dietmar Maurer
parent b7e18004a2
commit de0aa53174
1 changed files with 4 additions and 0 deletions

View File

@ -381,6 +381,10 @@ impl Decoder {
let _filename = self.inner.read_filename(head.size)?;
let head: PxarHeader = self.inner.read_item()?;
if head.htype == PXAR_FORMAT_HARDLINK {
let (_, diff) = self.inner.read_hardlink(head.size)?;
return self.read(offset - diff, size, data_offset);
}
check_ca_header::<PxarEntry>(&head, PXAR_ENTRY)?;
let _: PxarEntry = self.inner.read_item()?;