mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 06:16:30 +03:00
fix: fsync() the rename() of accounts.toml
This commit is contained in:
@@ -699,6 +699,14 @@ impl Config {
|
|||||||
fs::rename(&tmp_path, &self.file)
|
fs::rename(&tmp_path, &self.file)
|
||||||
.await
|
.await
|
||||||
.context("failed to rename config")?;
|
.context("failed to rename config")?;
|
||||||
|
// Sync the rename().
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
{
|
||||||
|
let parent = self.file.parent().context("No parent directory")?;
|
||||||
|
let parent_file = fs::File::open(parent).await?;
|
||||||
|
parent_file.sync_all().await?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user