From 74c76bb5cea8ff70153a8f9ebe02df6ffb0205f7 Mon Sep 17 00:00:00 2001 From: qvkap Date: Sat, 5 Sep 2026 08:29:46 +0300 Subject: fix: dependency resolution, update file removal and sync TLS validation --- src/config.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 2ff93d8..9a4a22e 100755 --- a/src/config.rs +++ b/src/config.rs @@ -1,8 +1,11 @@ use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fs; +use std::io::Write; +use std::os::unix::fs::PermissionsExt; use std::path::Path; use colored::Colorize; +use tempfile::NamedTempFile; #[derive(Debug, Deserialize, Serialize, Clone)] pub struct RepositoryConfig { @@ -155,7 +158,11 @@ impl Config { if let Some(parent) = path.parent() { fs::create_dir_all(parent)?; } - fs::write(path, ini) + let mut tmp = NamedTempFile::new_in(path.parent().unwrap_or(Path::new(".")))?; + tmp.write_all(ini.as_bytes())?; + fs::set_permissions(tmp.path(), std::fs::Permissions::from_mode(0o644))?; + tmp.persist(path)?; + Ok(()) } pub fn to_ini(&self) -> Result { @@ -225,7 +232,11 @@ impl Config { "gpg_key = \"rorka.pub\"\n", ); fs::create_dir_all(path.parent().unwrap())?; - fs::write(path, ini) + let mut tmp = NamedTempFile::new_in(path.parent().unwrap_or(Path::new(".")))?; + tmp.write_all(ini.as_bytes())?; + fs::set_permissions(tmp.path(), std::fs::Permissions::from_mode(0o644))?; + tmp.persist(path)?; + Ok(()) } } -- cgit v1.2.3