swab(1): adds null unveil
This commit is contained in:
parent
b946469da5
commit
8fd5bdf5a6
@ -33,7 +33,7 @@ use sysexits::{ EX_IOERR, EX_OK, EX_OSERR, EX_USAGE };
|
||||
use strerror::StrError;
|
||||
|
||||
#[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: &str, e: Error, code: u8) -> ExitCode {
|
||||
eprintln!("{}: {}", argv0, e.strerror());
|
||||
@ -49,10 +49,14 @@ fn main() -> ExitCode {
|
||||
let argv = args().collect::<Vec<String>>();
|
||||
|
||||
#[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, EX_OSERR);
|
||||
}
|
||||
|
||||
if let Err(e) = unveil(None, None) {
|
||||
return err(&argv[0], e, EX_OSERR);
|
||||
}
|
||||
}
|
||||
|
||||
let mut buf: Vec<u8> = Vec::new(); // holds the sequence getting swabbed
|
||||
|
Loading…
Reference in New Issue
Block a user