fix: fsync() the rename() of accounts.toml

This commit is contained in:
link2xt
2026-03-14 20:27:00 +00:00
committed by l
parent c6cdccdb97
commit e14151d6cc

View File

@@ -699,6 +699,14 @@ impl Config {
fs::rename(&tmp_path, &self.file)
.await
.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(())
}