]> git.proxmox.com Git - proxmox-backup.git/commitdiff
use O_EXCL when creating files during extraction
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 16 Jun 2020 08:33:14 +0000 (10:33 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 16 Jun 2020 08:33:27 +0000 (10:33 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/backup/catalog_shell.rs
src/pxar/extract.rs

index 0191f187458dd451c4f70516430a91e373ceed6d..94c81109a5a1d9cc11441d0cd3daf592ddf0c7c2 100644 (file)
@@ -1187,7 +1187,7 @@ impl<'a> ExtractorState<'a> {
                     std::fs::File::from_raw_fd(nix::fcntl::openat(
                         parent,
                         entry.file_name(),
-                        OFlag::O_CREAT | OFlag::O_WRONLY | OFlag::O_CLOEXEC,
+                        OFlag::O_CREAT | OFlag::O_EXCL | OFlag::O_WRONLY | OFlag::O_CLOEXEC,
                         Mode::from_bits(0o600).unwrap(),
                     )?)
                 });
index 715e25ea869b7fced6dcdc97624d8f87b998ef26..a4d746168a1b9d4517e687711fffd09cfe7c0979 100644 (file)
@@ -319,7 +319,7 @@ impl Extractor {
             std::fs::File::from_raw_fd(nix::fcntl::openat(
                 parent,
                 file_name,
-                OFlag::O_CREAT | OFlag::O_WRONLY | OFlag::O_CLOEXEC,
+                OFlag::O_CREAT | OFlag::O_EXCL | OFlag::O_WRONLY | OFlag::O_CLOEXEC,
                 Mode::from_bits(0o600).unwrap(),
             )?)
         };