diff --git a/crates/mind-body/src/control.rs b/crates/mind-body/src/control.rs index db3ad98..bf751e2 100644 --- a/crates/mind-body/src/control.rs +++ b/crates/mind-body/src/control.rs @@ -1,13 +1,4 @@ - // Every directory this write creates is 0755, ancestors included: a - // restrictive process umask would otherwise leave /etc/gamecult/minds - // untraversable by the units that only read. - let missing: Vec<&Path> = directory.ancestors().take_while(|ancestor| !ancestor.exists()).collect(); - if !missing.is_empty() { - std::fs::create_dir_all(directory).with_context(|| format!("failed to create {}", directory.display()))?; - for created in missing { - set_mode(created, DIR_MODE)?; - } - }//! The operator's brake and burn-rate dial, and the one reader of them. +//! The operator's brake and burn-rate dial, and the one reader of them. //! //! State is a CultCache single-file store at //! `/etc/gamecult/minds//control.cc`, root-owned and world-readable. @@ -295,9 +286,15 @@ impl ControlWriter { require_root_only_writable(existing)?; } } - if !directory.exists() { + // Every directory this write creates is 0755, ancestors included: a + // restrictive process umask would otherwise leave /etc/gamecult/minds + // untraversable by the units that only read. + let missing: Vec<&Path> = directory.ancestors().take_while(|ancestor| !ancestor.exists()).collect(); + if !missing.is_empty() { std::fs::create_dir_all(directory).with_context(|| format!("failed to create {}", directory.display()))?; - set_mode(directory, DIR_MODE)?; + for created in missing { + set_mode(created, DIR_MODE)?; + } } if !lock.exists() { std::fs::OpenOptions::new()