fop(1): adds null unveil

This commit is contained in:
Emma Tebibyte 2024-08-27 23:54:39 -06:00
parent b875aa1058
commit 5b666d6858
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -32,7 +32,8 @@ use sysexits::{ EX_DATAERR, EX_IOERR, EX_UNAVAILABLE, 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 };
fn err(argv0: &String, e: Error) {
eprintln!("{}: {}", argv0, e.strerror());
@ -49,11 +50,16 @@ fn main() -> ExitCode {
let mut optind = 1;
#[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio proc exec");
let promises = Promises::new("exec proc stdio unveil");
if let Err(e) = pledge(Some(promises), None) {
err(&argv[0], e);
return ExitCode::from(EX_OSERR);
}
if let Err(e) = unveil(None, None) {
err(&argv[0], e);
return ExitCode::from(EX_OSERR);
}
}
while let Some(opt) = argv.getopt("d:") {