From 6d80e532325dca14a13f2d69fa99470907c29821 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 6 Aug 2021 09:33:09 -0400 Subject: [PATCH] Simplify SqliteStore::from_path --- tor-dirmgr/src/storage/sqlite.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tor-dirmgr/src/storage/sqlite.rs b/tor-dirmgr/src/storage/sqlite.rs index dd74d954a..9d86abb40 100644 --- a/tor-dirmgr/src/storage/sqlite.rs +++ b/tor-dirmgr/src/storage/sqlite.rs @@ -69,17 +69,11 @@ impl SqliteStore { let blobpath = path.join("dir_blobs/"); let lockpath = path.join("dir.lock"); - #[cfg(target_family = "unix")] if !readonly { - std::fs::DirBuilder::new() - .recursive(true) - .mode(0o700) - .create(&blobpath) - .with_context(|| format!("Creating directory at {:?}", &blobpath))?; - } - #[cfg(not(target_family = "unix"))] - if !readonly { - std::fs::DirBuilder::new() + let mut builder = std::fs::DirBuilder::new(); + #[cfg(target_family = "unix")] + builder.mode(0o700); + builder .recursive(true) .create(&blobpath) .with_context(|| format!("Creating directory at {:?}", &blobpath))?;