Skip to content

Commit

Permalink
Tidy up configuration files UNIX permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
HorlogeSkynet committed May 8, 2024
1 parent 93d4987 commit b465026
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion libs/hbb_common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,15 @@ pub fn load_path<T: serde::Serialize + serde::de::DeserializeOwned + Default + s

#[inline]
pub fn store_path<T: serde::Serialize>(path: PathBuf, cfg: T) -> crate::ResultType<()> {
Ok(confy::store_path(path, cfg)?)
#[cfg(not(windows))]
{
use std::os::unix::fs::PermissionsExt;
Ok(confy::store_path_perms(path, cfg, fs::Permissions::from_mode(0o600))?)
}
#[cfg(windows)]
{
Ok(confy::store_path(path, cfg)?)
}
}

impl Config {
Expand Down

0 comments on commit b465026

Please sign in to comment.