From 44c5410bbfe6f25b0285770ddade31cdcc893801 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 9 Oct 2026 16:45:14 +0200 Subject: [PATCH] mind-body: create missing ancestor directories 0755 (the previous commit's edit mangled control.rs) Co-Authored-By: Claude Opus 5.5 --- crates/mind-body/src/control.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) 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()