From a18b03f3b875af475c7ad6b213fc1417cf14f8a7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 30 Oct 2019 11:16:53 +0100 Subject: [PATCH] c_call -> c_result for consistency Signed-off-by: Wolfgang Bumiller --- src/capability.rs | 4 ++-- src/fork.rs | 2 +- src/macros.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/capability.rs b/src/capability.rs index f76ba31..7c66e1a 100644 --- a/src/capability.rs +++ b/src/capability.rs @@ -19,12 +19,12 @@ bitflags::bitflags! { impl SecureBits { pub fn apply(self) -> io::Result<()> { - c_call!(unsafe { libc::prctl(libc::PR_SET_SECUREBITS, self.bits()) })?; + c_result!(unsafe { libc::prctl(libc::PR_SET_SECUREBITS, self.bits()) })?; Ok(()) } pub fn get_current() -> io::Result { - let bits = c_call!(unsafe { libc::prctl(libc::PR_GET_SECUREBITS) })?; + let bits = c_result!(unsafe { libc::prctl(libc::PR_GET_SECUREBITS) })?; Self::from_bits(bits as _) .ok_or_else(|| io_format_err!("prctl() returned unknown securebits")) } diff --git a/src/fork.rs b/src/fork.rs index 732cce7..db3f652 100644 --- a/src/fork.rs +++ b/src/fork.rs @@ -106,7 +106,7 @@ impl Fork { let mut status: c_int = -1; loop { - match c_call!(unsafe { libc::waitpid(my_pid, &mut status, 0) }) { + match c_result!(unsafe { libc::waitpid(my_pid, &mut status, 0) }) { Ok(pid) if pid == my_pid => break, Ok(_other) => continue, Err(ref err) if err.kind() == io::ErrorKind::Interrupted => continue, diff --git a/src/macros.rs b/src/macros.rs index a2a8cd8..4054661 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -49,7 +49,7 @@ macro_rules! file_descriptor_impl { }; } -macro_rules! c_call { +macro_rules! c_result { ($expr:expr) => {{ let res = $expr; if res == -1 { @@ -62,7 +62,7 @@ macro_rules! c_call { macro_rules! c_try { ($expr:expr) => { - c_call!($expr)? + c_result!($expr)? }; }