From e046570fa1dec385359299a4c701a3b9d66e5039 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 23 May 2021 14:42:41 -0700 Subject: [PATCH] fixup build on macos --- filedescriptor/src/unix.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/filedescriptor/src/unix.rs b/filedescriptor/src/unix.rs index 58bdeaaf4..6d48d602a 100644 --- a/filedescriptor/src/unix.rs +++ b/filedescriptor/src/unix.rs @@ -321,10 +321,7 @@ impl Pipe { let mut fds = [-1i32; 2]; let res = unsafe { libc::pipe(fds.as_mut_ptr()) }; if res == -1 { - bail!( - "failed to create a pipe: {:?}", - std::io::Error::last_os_error() - ) + Err(Error::Pipe(std::io::Error::last_os_error())) } else { let mut read = FileDescriptor { handle: OwnedHandle { @@ -382,10 +379,7 @@ pub fn socketpair_impl() -> Result<(FileDescriptor, FileDescriptor)> { let mut fds = [-1i32; 2]; let res = unsafe { libc::socketpair(libc::PF_LOCAL, libc::SOCK_STREAM, 0, fds.as_mut_ptr()) }; if res == -1 { - bail!( - "failed to create a socketpair: {:?}", - std::io::Error::last_os_error() - ) + Err(Error::Socketpair(std::io::Error::last_os_error())) } else { let mut read = FileDescriptor { handle: OwnedHandle { @@ -443,7 +437,7 @@ mod macos { if fd < 0 { return Err(Error::IllegalFdValue(fd.into())); } - if fd >= FD_SETSIZE { + if fd as usize >= FD_SETSIZE { return Err(Error::FdValueOutsideFdSetSize(fd.into())); } Ok(())