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 <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-07-16 13:19:48 +02:00 committed by Dietmar Maurer
parent a771f90745
commit 3ff4ef28e6
1 changed files with 1 additions and 4 deletions

View File

@ -612,8 +612,6 @@ impl <'a, W: Write> Encoder<'a, W> {
self.write_quota_project_id(projid)?; self.write_quota_project_id(projid)?;
} }
let mut dir_count = 0;
let include_children; let include_children;
if is_virtual_file_system(magic) { if is_virtual_file_system(magic) {
include_children = false; include_children = false;
@ -662,8 +660,7 @@ impl <'a, W: Write> Encoder<'a, W> {
(_, pattern_list) => name_list.push((filename, stat, pattern_list)), (_, pattern_list) => name_list.push((filename, stat, pattern_list)),
} }
dir_count += 1; if name_list.len() > MAX_DIRECTORY_ENTRIES {
if dir_count > MAX_DIRECTORY_ENTRIES {
bail!("too many directory items in {:?} (> {})", self.full_path(), MAX_DIRECTORY_ENTRIES); bail!("too many directory items in {:?} (> {})", self.full_path(), MAX_DIRECTORY_ENTRIES);
} }
} }