mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-04-28 18:50:04 +00:00
pxar: extract: Follow overwrite_flags when opening file
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
600ce36d57
commit
d4468ba6f8
@ -133,9 +133,18 @@ where
|
||||
|
||||
if let Some(ref path) = options.prelude_path {
|
||||
if let Some(entry) = prelude {
|
||||
let mut prelude_file = OpenOptions::new()
|
||||
.create(true)
|
||||
.write(true)
|
||||
let overwrite = options.overwrite_flags.contains(OverwriteFlags::FILE);
|
||||
|
||||
let mut open_options = OpenOptions::new();
|
||||
open_options.write(true);
|
||||
if overwrite {
|
||||
open_options.create(true);
|
||||
open_options.truncate(true);
|
||||
} else {
|
||||
open_options.create_new(true);
|
||||
}
|
||||
|
||||
let mut prelude_file = open_options
|
||||
.open(path)
|
||||
.with_context(|| format!("error creating prelude file '{path:?}'"))?;
|
||||
if let pxar::EntryKind::Prelude(ref prelude) = entry.kind() {
|
||||
|
Loading…
Reference in New Issue
Block a user