c_call -> c_result for consistency

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-10-30 11:16:53 +01:00
parent d1b1deab3d
commit a18b03f3b8
3 changed files with 5 additions and 5 deletions

View File

@ -19,12 +19,12 @@ bitflags::bitflags! {
impl SecureBits { impl SecureBits {
pub fn apply(self) -> io::Result<()> { 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(()) Ok(())
} }
pub fn get_current() -> io::Result<Self> { pub fn get_current() -> io::Result<Self> {
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 _) Self::from_bits(bits as _)
.ok_or_else(|| io_format_err!("prctl() returned unknown securebits")) .ok_or_else(|| io_format_err!("prctl() returned unknown securebits"))
} }

View File

@ -106,7 +106,7 @@ impl Fork {
let mut status: c_int = -1; let mut status: c_int = -1;
loop { 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(pid) if pid == my_pid => break,
Ok(_other) => continue, Ok(_other) => continue,
Err(ref err) if err.kind() == io::ErrorKind::Interrupted => continue, Err(ref err) if err.kind() == io::ErrorKind::Interrupted => continue,

View File

@ -49,7 +49,7 @@ macro_rules! file_descriptor_impl {
}; };
} }
macro_rules! c_call { macro_rules! c_result {
($expr:expr) => {{ ($expr:expr) => {{
let res = $expr; let res = $expr;
if res == -1 { if res == -1 {
@ -62,7 +62,7 @@ macro_rules! c_call {
macro_rules! c_try { macro_rules! c_try {
($expr:expr) => { ($expr:expr) => {
c_call!($expr)? c_result!($expr)?
}; };
} }