c_call -> c_result for consistency
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
d1b1deab3d
commit
a18b03f3b8
@ -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<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 _)
|
||||
.ok_or_else(|| io_format_err!("prctl() returned unknown securebits"))
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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)?
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user