src/pxar/decoder.rs: fix issue with restore
`Decoder::restore()` calls the `SequentialDecoder::restore()` which expects to encounter a `PxarEntry` at first. But the start of `DirectoryEntry` points to the filename (except for the root dir), so skip over it. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
9708b2d98c
commit
5e8d600c71
@ -70,6 +70,16 @@ impl<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<R, F> {
|
|||||||
|
|
||||||
self.seek(SeekFrom::Start(start))?;
|
self.seek(SeekFrom::Start(start))?;
|
||||||
|
|
||||||
|
// Except for the root dir, `DirectoryEntry` start points to the filename.
|
||||||
|
// But `SequentialDecoder::restore()` expects the entry point to be of
|
||||||
|
// type `PxarEntry`, so lets skip over the filename here if present.
|
||||||
|
if start != 0 {
|
||||||
|
let header: PxarHeader = self.inner.read_item()?;
|
||||||
|
if header.htype != PXAR_FILENAME {
|
||||||
|
bail!("Expected PXAR_FILENAME, encountered 0x{:x?}", header.htype);
|
||||||
|
}
|
||||||
|
let _filename = self.inner.read_filename(header.size)?;
|
||||||
|
}
|
||||||
self.inner.restore(path, &Vec::new())?;
|
self.inner.restore(path, &Vec::new())?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user