optimizations #161
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user