From 3ff4ef28e6792ac717401a884665a9f27361f894 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Tue, 16 Jul 2019 13:19:48 +0200 Subject: [PATCH] src/pxar/encoder.rs: remove unneeded dir_count dir_count was used to track the number of directory entries to store in the archive and bail if the maximum is exceeded. As the number of entries is equally obtained from the list of the filenames to include, use that one instead. Signed-off-by: Christian Ebner --- src/pxar/encoder.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pxar/encoder.rs b/src/pxar/encoder.rs index e4db5fc5..734de4a3 100644 --- a/src/pxar/encoder.rs +++ b/src/pxar/encoder.rs @@ -612,8 +612,6 @@ impl <'a, W: Write> Encoder<'a, W> { self.write_quota_project_id(projid)?; } - let mut dir_count = 0; - let include_children; if is_virtual_file_system(magic) { include_children = false; @@ -662,8 +660,7 @@ impl <'a, W: Write> Encoder<'a, W> { (_, pattern_list) => name_list.push((filename, stat, pattern_list)), } - dir_count += 1; - if dir_count > MAX_DIRECTORY_ENTRIES { + if name_list.len() > MAX_DIRECTORY_ENTRIES { bail!("too many directory items in {:?} (> {})", self.full_path(), MAX_DIRECTORY_ENTRIES); } }