pxar: decoder: return original name in attributes()

The returned filename should be the one of the file given at the offset, not of
the one the hardlink points to.

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

View File

@ -339,7 +339,10 @@ impl Decoder {
if marker == PXAR_FORMAT_HARDLINK {
let size: u64 = self.inner.read_item()?;
let (_, diff) = self.inner.read_hardlink(size)?;
return self.attributes(offset - diff);
// Make sure to return the original filename,
// not the one read from the hardlink.
let (_, entry, xattr, file_size) = self.attributes(offset - diff)?;
return Ok((filename, entry, xattr, file_size));
}
if marker != PXAR_ENTRY {