[pbs-devel] [PATCH proxmox-backup 1/2] fix 2885: bail on duplicate backup target

Stoiko Ivanov s.ivanov at proxmox.com
Thu Jul 23 18:16:36 CEST 2020


Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/bin/proxmox-backup-client.rs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs
index 32483c00..fc2d77ce 100644
--- a/src/bin/proxmox-backup-client.rs
+++ b/src/bin/proxmox-backup-client.rs
@@ -935,12 +935,18 @@ async fn create_backup(
     }
 
     let mut upload_list = vec![];
+    let mut target_set = HashSet::new();
 
     for backupspec in backupspec_list {
         let spec = parse_backup_specification(backupspec.as_str().unwrap())?;
         let filename = &spec.config_string;
         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;
 
         let metadata = std::fs::metadata(filename)
-- 
2.20.1






More information about the pbs-devel mailing list