diff --git a/src/fop.rs b/src/fop.rs index 66b7e82..7c8424e 100644 --- a/src/fop.rs +++ b/src/fop.rs @@ -39,7 +39,7 @@ fn main() { let mut d = '\u{1E}'.to_string(); /* ASCII record separator */ let mut optind = 1; - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { let promises = Promises::new("stdio proc exec"); if let Err(e) = pledge(Some(promises), None) { eprintln!("{}: {}", argv[0], e.strerror()); diff --git a/src/hru.rs b/src/hru.rs index c6009a7..e07ec39 100644 --- a/src/hru.rs +++ b/src/hru.rs @@ -86,7 +86,7 @@ fn main() -> ExitCode { return ExitCode::from(EX_USAGE as u8); } - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { let promises = Promises::new("stdio"); if let Err(e) = pledge(Some(promises), None) { eprintln!("{}: {}", argv[0], e.strerror()); diff --git a/src/intcmp.rs b/src/intcmp.rs index a7c045d..456f268 100644 --- a/src/intcmp.rs +++ b/src/intcmp.rs @@ -42,7 +42,7 @@ fn usage(s: &str) -> ExitCode { fn main() -> ExitCode { let argv = args().collect::>(); - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { let promises = Promises::new("stdio"); if let Err(e) = pledge(Some(promises), None) { eprintln!("{}: {}", argv[0], e.strerror()); diff --git a/src/mm.rs b/src/mm.rs index b99bf9e..755c382 100644 --- a/src/mm.rs +++ b/src/mm.rs @@ -51,7 +51,7 @@ fn main() -> ExitCode { let argv = args().collect::>(); let usage = format!("Usage: {} [-aetu] [-i input] [-o output]", argv[0]); - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { let promises = Promises::new("rpath stdio unveil"); if let Err(e) = pledge(Some(promises), None) { eprintln!("{}: {}", argv[0], e.strerror()); @@ -77,7 +77,7 @@ fn main() -> ExitCode { Ok("i") => { /* add inputs */ let input = opt.arg().unwrap(); - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { let perms = UnveilPerms::new(vec!['r']); if let Err(e) = unveil(Some(&input), Some(perms)) { eprintln!("{}: {}", argv[0], e.strerror()); @@ -91,7 +91,7 @@ fn main() -> ExitCode { Ok("o") => { /* add output */ let output = opt.arg().unwrap(); - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { let perms = UnveilPerms::new(vec!['w', 'c']); if let Err(e) = unveil(Some(&output), Some(perms)) { eprintln!("{}: {}", argv[0], e.strerror()); @@ -124,7 +124,7 @@ fn main() -> ExitCode { } } - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { if let Err(e) = unveil(None, None) { eprintln!("{}: {}", argv[0], e.strerror()); return ExitCode::from(EX_OSERR as u8); diff --git a/src/rpn.rs b/src/rpn.rs index e4f725d..7669efb 100644 --- a/src/rpn.rs +++ b/src/rpn.rs @@ -198,7 +198,7 @@ fn round_precise(value: &f64, precision: usize) -> f64 { fn main() -> ExitCode { let argv = args().collect::>(); - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { let promises = Promises::new("stdio"); if let Err(e) = pledge(Some(promises), None) { eprintln!("{}: {}", argv[0], e.strerror()); diff --git a/src/swab.rs b/src/swab.rs index 27ce9a5..4dc86de 100644 --- a/src/swab.rs +++ b/src/swab.rs @@ -54,7 +54,7 @@ fn usage(s: &str) -> ExitCode { fn main() -> ExitCode { let argv = args().collect::>(); - if cfg!(target_os="openbsd") { + #[cfg(target_os="openbsd")] { let promises = Promises::new("stdio"); if let Err(e) = pledge(Some(promises), None) { return oserr(&argv[0], e);