all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] fix 2885: bail on duplicate backup target
Date: Thu, 23 Jul 2020 16:16:36 +0000	[thread overview]
Message-ID: <20200723161637.6280-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20200723161637.6280-1-s.ivanov@proxmox.com>

Signed-off-by: Stoiko Ivanov <s.ivanov@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





  reply	other threads:[~2020-07-23 16:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 16:16 [pbs-devel] [PATCH proxmox-backup 0/2] fix 2885 and a division by zero Stoiko Ivanov
2020-07-23 16:16 ` Stoiko Ivanov [this message]
2020-07-24  9:12   ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] fix 2885: bail on duplicate backup target Thomas Lamprecht
2020-07-23 16:16 ` [pbs-devel] [PATCH proxmox-backup 2/2] fix division by zero Stoiko Ivanov
2020-07-24  5:52   ` Fabian Grünbichler
2020-07-24  7:15   ` Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200723161637.6280-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal