Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update nix to 0.24.0 #2218

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion druid-shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ gdk-sys = { version = "0.14.0", optional = true }
gtk-rs = { version = "0.14.0", features = ["v3_22"], package = "gtk", optional = true }
glib-sys = { version = "0.14.0", optional = true }
gtk-sys = { version = "0.14.0", optional = true }
nix = { version = "0.18.0", optional = true }
nix = { version = "0.24.0", optional = true }
x11rb = { version = "0.8.0", features = ["allow-unsafe-code", "present", "render", "randr", "xfixes", "xkb", "resource_manager", "cursor"], optional = true }
wayland-client = { version = "0.29", optional = true }
wayland-protocols = { version = "0.29", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion druid-shell/src/backend/wayland/surfaces/buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ impl Shm {
self.size = new_size;
return Ok(());
}
Err(e) if matches!(e.as_errno(), Some(Errno::EINTR)) => {
Err(Errno::EINTR) => {
// continue (try again)
}
Err(e) => {
Expand Down
6 changes: 3 additions & 3 deletions druid-shell/src/backend/x11/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,10 +846,10 @@ fn drain_idle_pipe(idle_read: RawFd) -> Result<(), Error> {
let mut read_buf = [0u8; 16];
loop {
match nix::unistd::read(idle_read, &mut read_buf[..]) {
Err(nix::Error::Sys(nix::errno::Errno::EINTR)) => {}
Err(nix::errno::Errno::EINTR) => {}
// According to write(2), this is the outcome of reading an empty, O_NONBLOCK
// pipe.
Err(nix::Error::Sys(nix::errno::Errno::EAGAIN)) => {
Err(nix::errno::Errno::EAGAIN) => {
break;
}
Err(e) => {
Expand Down Expand Up @@ -944,7 +944,7 @@ fn poll_with_timeout(
}
}

Err(nix::Error::Sys(nix::errno::Errno::EINTR)) => {
Err(nix::errno::Errno::EINTR) => {
now = Instant::now();
}
Err(e) => return Err(e.into()),
Expand Down
13 changes: 2 additions & 11 deletions druid-shell/src/backend/x11/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,17 +689,8 @@ fn wait_for_event_with_deadline(
// Wait for the socket to be readable via poll() and try again
match poll(&mut poll_fds, poll_timeout) {
Ok(_) => {}
Err(nix::Error::Sys(nix::errno::Errno::EINTR)) => {}
Err(e) => return Err(nix_error_to_io(e).into()),
Err(nix::errno::Errno::EINTR) => {}
Err(e) => return Err(std::io::Error::from(e).into()),
}
}
}

fn nix_error_to_io(e: nix::Error) -> std::io::Error {
use std::io::{Error, ErrorKind};
match e {
nix::Error::Sys(errno) => errno.into(),
nix::Error::InvalidPath | nix::Error::InvalidUtf8 => Error::new(ErrorKind::InvalidInput, e),
nix::Error::UnsupportedOperation => std::io::Error::new(ErrorKind::Other, e),
}
}
4 changes: 2 additions & 2 deletions druid-shell/src/backend/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,8 +1544,8 @@ impl IdleHandle {
fn wake(&self) {
loop {
match nix::unistd::write(self.pipe, &[0]) {
Err(nix::Error::Sys(nix::errno::Errno::EINTR)) => {}
Err(nix::Error::Sys(nix::errno::Errno::EAGAIN)) => {}
Err(nix::errno::Errno::EINTR) => {}
Err(nix::errno::Errno::EAGAIN) => {}
Err(e) => {
error!("Failed to write to idle pipe: {}", e);
break;
Expand Down