diff options
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/tpd.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/bin/tpd.rs b/src/bin/tpd.rs index c37afb6..54dbd7f 100644 --- a/src/bin/tpd.rs +++ b/src/bin/tpd.rs @@ -140,11 +140,11 @@ fn main() { eprintln!("error: cannot create {}: {e}", dir.display()); std::process::exit(1); } - if let Some(parent) = sock_path.parent() { - if let Err(e) = std::fs::create_dir_all(parent) { - eprintln!("error: cannot create {}: {e}", parent.display()); - std::process::exit(1); - } + if let Some(parent) = sock_path.parent() + && let Err(e) = std::fs::create_dir_all(parent) + { + eprintln!("error: cannot create {}: {e}", parent.display()); + std::process::exit(1); } let store = match PasteStore::open(&dir) { @@ -198,10 +198,10 @@ fn main() { // Apply unveil(2) to restrict filesystem visibility, // then pledge(2) to restrict syscalls. sandbox::do_unveil(&dir, "rwc"); - if sock_path.parent() != Some(dir.as_ref()) { - if let Some(parent) = sock_path.parent() { - sandbox::do_unveil(parent, "rwc"); - } + if sock_path.parent() != Some(dir.as_ref()) + && let Some(parent) = sock_path.parent() + { + sandbox::do_unveil(parent, "rwc"); } if !no_auto_bootstrap || !bootstrap.is_empty() { sandbox::do_unveil(std::path::Path::new("/etc/resolv.conf"), "r"); |