Compare commits

..

6 Commits

6 changed files with 9 additions and 5 deletions

View File

@ -95,7 +95,7 @@ fn main() -> ExitCode {
#[cfg(target_os="openbsd")] { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio unveil"); let promises = Promises::new("stdio unveil");
if let Err(e) = pledge(Some(promises), None) { if let Err(e) = pledge(Some(promises), Some(Promises::default())) {
return err(&argv[0], e.strerror(), Some(EX_OSERR)); return err(&argv[0], e.strerror(), Some(EX_OSERR));
} }

View File

@ -49,7 +49,7 @@ fn main() -> ExitCode {
#[cfg(target_os="openbsd")] { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio unveil"); let promises = Promises::new("stdio unveil");
if let Err(e) = pledge(Some(promises), None) { if let Err(e) = pledge(Some(promises), Some(Promises::default())) {
return err(&argv[0], e.strerror(), EX_OSERR); return err(&argv[0], e.strerror(), EX_OSERR);
} }

View File

@ -43,6 +43,10 @@ impl Promises {
} }
} }
impl Default for Promises {
fn default() -> Self { Promises::new("") }
}
pub fn pledge( pub fn pledge(
promises: Option<Promises>, execpromises: Option<Promises> promises: Option<Promises>, execpromises: Option<Promises>
) -> Result<(), Error> { ) -> Result<(), Error> {

View File

@ -62,7 +62,7 @@ fn main() -> ExitCode {
#[cfg(target_os="openbsd")] { #[cfg(target_os="openbsd")] {
let promises = Promises::new("cpath rpath stdio unveil wpath"); let promises = Promises::new("cpath rpath stdio unveil wpath");
if let Err(e) = pledge(Some(promises), None) { if let Err(e) = pledge(Some(promises), Some(Promises::default())) {
return err(&argv[0], e, Some(EX_OSERR)); return err(&argv[0], e, Some(EX_OSERR));
} }
} }

View File

@ -231,7 +231,7 @@ fn main() -> ExitCode {
#[cfg(target_os="openbsd")] { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio unveil"); let promises = Promises::new("stdio unveil");
if let Err(e) = pledge(Some(promises), None) { if let Err(e) = pledge(Some(promises), Some(Promises::default())) {
return err(&argv[0], &e, Some(EX_OSERR)); return err(&argv[0], &e, Some(EX_OSERR));
} }

View File

@ -50,7 +50,7 @@ fn main() -> ExitCode {
#[cfg(target_os="openbsd")] { #[cfg(target_os="openbsd")] {
let promises = Promises::new("stdio unveil"); let promises = Promises::new("stdio unveil");
if let Err(e) = pledge(Some(promises), None) { if let Err(e) = pledge(Some(promises), Some(Promises::default())) {
return err(&argv[0], e, EX_OSERR); return err(&argv[0], e, EX_OSERR);
} }