Fix overflow, race condition, and format bugs

This commit is contained in:
2026-03-07 22:14:48 +02:00
parent 150d483fbe
commit f471d22767
18 changed files with 600 additions and 113 deletions

View File

@@ -14,7 +14,7 @@ fn default_config_dir() -> PathBuf {
}
/// Write to a temporary file then rename, for crash safety.
fn atomic_write(path: &Path, contents: &str) -> std::io::Result<()> {
pub fn atomic_write(path: &Path, contents: &str) -> std::io::Result<()> {
let tmp = path.with_extension("tmp");
std::fs::write(&tmp, contents)?;
std::fs::rename(&tmp, path)?;