You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rust-ctrlc/0001-Update-to-nix-0.10.patch

54 lines
2.0 KiB

From 485f893f851eb3eb74ba32182a579c0faf10fd94 Mon Sep 17 00:00:00 2001
From: Josh Stone <cuviper@gmail.com>
Date: Mon, 26 Feb 2018 23:58:32 -0800
Subject: [PATCH] Update to nix 0.10
---
src/platform/unix.rs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/platform/unix.rs b/src/platform/unix.rs
index 18cf3d8..2bbd5e3 100644
--- a/src/platform/unix.rs
+++ b/src/platform/unix.rs
@@ -44,7 +44,7 @@ pub unsafe fn init_os_handler() -> Result<(), Error> {
use self::nix::fcntl;
use self::nix::sys::signal;
- PIPE = unistd::pipe2(fcntl::O_CLOEXEC).map_err(|e| Error::System(nix_err_to_io_err(e)))?;
+ PIPE = unistd::pipe2(fcntl::OFlag::O_CLOEXEC).map_err(|e| Error::System(nix_err_to_io_err(e)))?;
let close_pipe = |e: nix::Error| -> Error {
unistd::close(PIPE.1).is_ok();
@@ -53,12 +53,16 @@ pub unsafe fn init_os_handler() -> Result<(), Error> {
};
// Make sure we never block on write in the os handler.
- if let Err(e) = fcntl::fcntl(PIPE.1, fcntl::FcntlArg::F_SETFL(fcntl::O_NONBLOCK)) {
+ if let Err(e) = fcntl::fcntl(PIPE.1, fcntl::FcntlArg::F_SETFL(fcntl::OFlag::O_NONBLOCK)) {
return Err(close_pipe(e));
}
let handler = signal::SigHandler::Handler(os_handler);
- let new_action = signal::SigAction::new(handler, signal::SA_RESTART, signal::SigSet::empty());
+ let new_action = signal::SigAction::new(
+ handler,
+ signal::SaFlags::SA_RESTART,
+ signal::SigSet::empty(),
+ );
let _old = match signal::sigaction(signal::Signal::SIGINT, &new_action) {
Ok(old) => old,
@@ -97,7 +101,7 @@ pub unsafe fn block_ctrl_c() -> Result<(), Error> {
match unistd::read(PIPE.0, &mut buf[..]) {
Ok(1) => break,
Ok(_) => return Err(Error::System(io::ErrorKind::UnexpectedEof.into()).into()),
- Err(nix::Error::Sys(nix::Errno::EINTR)) => {}
+ Err(nix::Error::Sys(nix::errno::Errno::EINTR)) => {}
Err(e) => return Err(Error::System(nix_err_to_io_err(e))),
}
}
--
2.16.2