use new fsync parameter to replace_file and atomic_open_or_create
Depend on proxmox 0.15.0 and proxmox-openid 0.8.1 Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
@ -17,7 +17,7 @@ regex = "1.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
||||
proxmox = "0.14.0"
|
||||
proxmox = "0.15.0"
|
||||
proxmox-lang = "1"
|
||||
proxmox-router = { version = "1.1", default-features = false }
|
||||
proxmox-schema = "1"
|
||||
|
@ -281,7 +281,7 @@ impl KeyConfig {
|
||||
try_block!({
|
||||
if replace {
|
||||
let mode = nix::sys::stat::Mode::S_IRUSR | nix::sys::stat::Mode::S_IWUSR;
|
||||
replace_file(path, data.as_bytes(), CreateOptions::new().perm(mode))?;
|
||||
replace_file(path, data.as_bytes(), CreateOptions::new().perm(mode), true)?;
|
||||
} else {
|
||||
use std::os::unix::fs::OpenOptionsExt;
|
||||
|
||||
|
@ -80,7 +80,7 @@ pub fn replace_backup_config<P: AsRef<std::path::Path>>(
|
||||
.owner(nix::unistd::ROOT)
|
||||
.group(backup_user.gid);
|
||||
|
||||
proxmox::tools::fs::replace_file(path, data, options)?;
|
||||
proxmox::tools::fs::replace_file(path, data, options, true)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -100,7 +100,7 @@ pub fn replace_secret_config<P: AsRef<std::path::Path>>(
|
||||
.owner(nix::unistd::ROOT)
|
||||
.group(nix::unistd::Gid::from_raw(0));
|
||||
|
||||
proxmox::tools::fs::replace_file(path, data, options)?;
|
||||
proxmox::tools::fs::replace_file(path, data, options, true)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -47,7 +47,10 @@ impl Memcom {
|
||||
let file = proxmox::tools::fs::atomic_open_or_create_file(
|
||||
MEMCOM_FILE_PATH,
|
||||
OFlag::O_RDWR | OFlag::O_CLOEXEC,
|
||||
&EMPTY_PAGE, options)?;
|
||||
&EMPTY_PAGE,
|
||||
options,
|
||||
true,
|
||||
)?;
|
||||
|
||||
let mmap = unsafe {
|
||||
Mmap::<u8>::map_fd(
|
||||
|
@ -448,7 +448,7 @@ pub fn save_config(config: &NetworkConfig) -> Result<(), Error> {
|
||||
.owner(nix::unistd::ROOT)
|
||||
.group(nix::unistd::Gid::from_raw(0));
|
||||
|
||||
replace_file(NETWORK_INTERFACES_NEW_FILENAME, &raw, options)?;
|
||||
replace_file(NETWORK_INTERFACES_NEW_FILENAME, &raw, options, true)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ fn write_file(data: HashMap<Authid, String>) -> Result<(), Error> {
|
||||
.group(backup_user.gid);
|
||||
|
||||
let json = serde_json::to_vec(&data)?;
|
||||
proxmox::tools::fs::replace_file(CONF_FILE, &json, options)
|
||||
proxmox::tools::fs::replace_file(CONF_FILE, &json, options, true)
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user