src/pxar/encoder.rs: avoid duplicate check for MAX_DIRECTORY_ENTRIES

Simply by reordering code.
This commit is contained in:
Dietmar Maurer 2019-10-23 07:55:56 +02:00
parent 62d123e50a
commit ffe171c5db

View File

@ -700,6 +700,13 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
}; };
if include_children { if include_children {
// Exclude patterns passed via the CLI are stored as '.pxarexclude-cli'
// in the root directory of the archive.
if is_root && match_pattern.len() > 0 {
let filename = CString::new(".pxarexclude-cli")?;
name_list.push((filename, dir_stat.clone(), match_pattern.clone()));
}
for entry in dir.iter() { for entry in dir.iter() {
let entry = entry let entry = entry
.map_err(|err| format_err!("readir {:?} failed - {}", self.full_path(), err))?; .map_err(|err| format_err!("readir {:?} failed - {}", self.full_path(), err))?;
@ -750,20 +757,6 @@ impl<'a, W: Write, C: BackupCatalogWriter> Encoder<'a, W, C> {
); );
} }
} }
// Exclude patterns passed via the CLI are stored as '.pxarexclude-cli'
// in the root directory of the archive.
if is_root && match_pattern.len() > 0 {
let filename = CString::new(".pxarexclude-cli")?;
name_list.push((filename, dir_stat.clone(), match_pattern.clone()));
if name_list.len() > MAX_DIRECTORY_ENTRIES {
bail!(
"too many directory items in {:?} (> {})",
self.full_path(),
MAX_DIRECTORY_ENTRIES
);
}
}
} else { } else {
eprintln!("skip mount point: {:?}", self.full_path()); eprintln!("skip mount point: {:?}", self.full_path());
} }