fix 2885: bail on duplicate backup target

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
Stoiko Ivanov 2020-07-23 16:16:36 +00:00 committed by Thomas Lamprecht
parent ea9e559fc4
commit f2b4b4b9fe
1 changed files with 6 additions and 0 deletions

View File

@ -935,12 +935,18 @@ async fn create_backup(
} }
let mut upload_list = vec![]; let mut upload_list = vec![];
let mut target_set = HashSet::new();
for backupspec in backupspec_list { for backupspec in backupspec_list {
let spec = parse_backup_specification(backupspec.as_str().unwrap())?; let spec = parse_backup_specification(backupspec.as_str().unwrap())?;
let filename = &spec.config_string; let filename = &spec.config_string;
let target = &spec.archive_name; let target = &spec.archive_name;
if target_set.contains(target) {
bail!("got target twice: '{}'", target);
}
target_set.insert(target.to_string());
use std::os::unix::fs::FileTypeExt; use std::os::unix::fs::FileTypeExt;
let metadata = std::fs::metadata(filename) let metadata = std::fs::metadata(filename)