src/pxar/decoder.rs: get correct stats for root directory

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Christian Ebner 2019-08-20 13:40:18 +02:00 committed by Wolfgang Bumiller
parent 7d26720e79
commit 58262f40f7

View File

@ -43,19 +43,17 @@ impl <R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<R, F> {
})
}
pub fn root(&self) -> DirectoryEntry {
DirectoryEntry {
pub fn root(&mut self) -> Result<DirectoryEntry, Error> {
self.seek(SeekFrom::Start(0))?;
let header: PxarHeader = self.inner.read_item()?;
check_ca_header::<PxarEntry>(&header, PXAR_ENTRY)?;
let entry: PxarEntry = self.inner.read_item()?;
Ok(DirectoryEntry {
start: self.root_start,
end: self.root_end,
filename: OsString::new(), // Empty
entry: PxarEntry {
mode: 0,
flags: 0,
uid: 0,
gid: 0,
mtime: 0,
}
}
entry: entry,
})
}
fn seek(&mut self, pos: SeekFrom) -> Result<u64, Error> {