From 2ec208aef55a0effed64f33a3de47b4adddaeb12 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 12 Nov 2019 12:47:21 +0100 Subject: [PATCH] src/backup/catalog.rs - CatalogReader::dump(): use root() --- src/backup/catalog.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backup/catalog.rs b/src/backup/catalog.rs index 9e2fa137..84b0d285 100644 --- a/src/backup/catalog.rs +++ b/src/backup/catalog.rs @@ -381,13 +381,16 @@ impl CatalogReader { Self { reader } } + /// Print catalog to stdout pub fn dump(&mut self) -> Result<(), Error> { - self.reader.seek(SeekFrom::End(-8))?; - - let start = unsafe { self.reader.read_le_value::()? }; - - self.dump_dir(std::path::Path::new("./"), start) + let root = self.root()?; + match root { + DirEntry { attr: DirEntryAttribute::Directory { start }, .. }=> { + self.dump_dir(std::path::Path::new("./"), start) + } + _ => unreachable!(), + } } /// Get the root DirEntry