mind-body: create missing ancestor directories 0755 (the previous commit's edit mangled control.rs)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
eb8aefc0fb
commit
44c5410bbf
1 changed files with 9 additions and 12 deletions
|
|
@ -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/<instance>/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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue