hru(1): adds null unveil

This commit is contained in:
Emma Tebibyte 2024-08-27 23:57:12 -06:00
parent 5b666d6858
commit 9aeadd8f8f
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -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();