aboutsummaryrefslogtreecommitdiffstats
path: root/src/store.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/store.rs')
-rw-r--r--src/store.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/store.rs b/src/store.rs
index 08d0959..9de62d3 100644
--- a/src/store.rs
+++ b/src/store.rs
@@ -14,7 +14,7 @@
//! RUN/tmp/ scratch
//! ```
//!
-//! Entries are root's (mode 0600). A new snapshot
+//! Entries are root's (mode 0600), and the state directory is 0700. A new snapshot
//! or view generation is written next to the old one and put in place by replacing
//! a symbolic link, so a reader sees one or the other, never a mix; a snapshot is
//! flushed to disk before that, so a crash leaves the old one or the new one.
@@ -77,6 +77,10 @@ impl Store {
/// Waits for, and takes, the store's lock: one receptor at a time.
pub fn lock(&self) -> Result<Lock> {
create_dir(&self.state, 0o700)?;
+ // Whatever created it (a deploy copying into incoming/, say), it is root's.
+ use std::os::unix::fs::PermissionsExt;
+ std::fs::set_permissions(&self.state, std::fs::Permissions::from_mode(0o700))
+ .with_context(|| format!("chmod {}", self.state.display()))?;
let path = self.state.join("lock");
let file = File::options()
.create(true)