From f90cbb7eddabcf047f37adc220a8139f1582e2d4 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 30 Dec 2019 10:05:57 +0100 Subject: [PATCH] tools: fs: default to 644 for mode in replace_file Signed-off-by: Wolfgang Bumiller --- proxmox-tools/src/fs.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/proxmox-tools/src/fs.rs b/proxmox-tools/src/fs.rs index eacf0733..0250985c 100644 --- a/proxmox-tools/src/fs.rs +++ b/proxmox-tools/src/fs.rs @@ -97,11 +97,9 @@ pub fn replace_file>( .perm .unwrap_or(stat::Mode::from_bits_truncate(0o644)); - if options.perm.is_some() { - if let Err(err) = stat::fchmod(fd, mode) { - let _ = unistd::unlink(tmp_path); - bail!("fchmod {:?} failed: {}", tmp_path, err); - } + if let Err(err) = stat::fchmod(fd, mode) { + let _ = unistd::unlink(tmp_path); + bail!("fchmod {:?} failed: {}", tmp_path, err); } if options.owner.is_some() || options.group.is_some() {