From 9aeadd8f8fd73781663dc8c9e301eeca9028fac6 Mon Sep 17 00:00:00 2001 From: emma Date: Tue, 27 Aug 2024 23:57:12 -0600 Subject: [PATCH] hru(1): adds null unveil --- src/hru.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hru.rs b/src/hru.rs index 236a2aa..978f261 100644 --- a/src/hru.rs +++ b/src/hru.rs @@ -31,7 +31,7 @@ use sysexits::{ EX_DATAERR, EX_IOERR, EX_SOFTWARE, EX_USAGE }; #[cfg(target_os="openbsd")] use sysexits::EX_OSERR; #[cfg(target_os="openbsd")] extern crate openbsd; -#[cfg(target_os="openbsd")] use openbsd::{ Promises, pledge }; +#[cfg(target_os="openbsd")] use openbsd::{ Promises, pledge, unveil }; /* list of SI prefixes */ const LIST: [(u32, &str); 10] = [ @@ -94,10 +94,14 @@ fn main() -> ExitCode { if let Some(_) = argv.get(1) { return usage(&argv[0]); } #[cfg(target_os="openbsd")] { - let promises = Promises::new("stdio"); + let promises = Promises::new("stdio unveil"); if let Err(e) = pledge(Some(promises), None) { return err(&argv[0], e.strerror(), Some(EX_OSERR)); } + + if let Err(e) = unveil(None, None) { + return err(&argv[0], e.strerror(), Some(EX_OSERR)); + } } let mut buf = String::new();