From b8cb8723bd347f1c9477c94a41f97f08f1c1fc7b Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 1 Jun 2022 14:35:05 +0200 Subject: [PATCH] update to nix 0.24 Signed-off-by: Wolfgang Bumiller --- Cargo.toml | 2 +- src/client.rs | 4 +--- src/io/seq_packet.rs | 4 ++-- src/main.rs | 4 ++-- src/syscall.rs | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 78bd31c..522ba2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,5 @@ bitflags = "1.2" anyhow = "1.0" lazy_static = "1.4" libc = "0.2" -nix = "0.19" +nix = "0.24" tokio = { version = "1.0", features = [ "rt-multi-thread", "io-util", "net" ] } diff --git a/src/client.rs b/src/client.rs index aaaf0be..7f27ce9 100644 --- a/src/client.rs +++ b/src/client.rs @@ -50,9 +50,7 @@ impl Client { Ok(r) => r, Err(err) => { // handle the various kinds of errors we may get: - if let Some(errno) = err.downcast_ref::() { - SyscallStatus::Err(*errno as _) - } else if let Some(nix::Error::Sys(errno)) = err.downcast_ref::() { + if let Some(errno) = err.downcast_ref::() { SyscallStatus::Err(*errno as _) } else if let Some(ioerr) = err.downcast_ref::() { if let Some(errno) = ioerr.raw_os_error() { diff --git a/src/io/seq_packet.rs b/src/io/seq_packet.rs index 2c26dec..68d968b 100644 --- a/src/io/seq_packet.rs +++ b/src/io/seq_packet.rs @@ -4,7 +4,7 @@ use std::ptr; use std::task::{Context, Poll}; use anyhow::Error; -use nix::sys::socket::{self, AddressFamily, SockAddr, SockFlag, SockType}; +use nix::sys::socket::{self, AddressFamily, SockFlag, SockType, SockaddrLike}; use crate::io::polled_fd::PolledFd; use crate::poll_fn::poll_fn; @@ -33,7 +33,7 @@ impl AsRawFd for SeqPacketListener { } impl SeqPacketListener { - pub fn bind(address: &SockAddr) -> Result { + pub fn bind(address: &dyn SockaddrLike) -> Result { let fd = seq_packet_socket(SockFlag::empty())?; socket::bind(fd.as_raw_fd(), address)?; socket::listen(fd.as_raw_fd(), 16)?; diff --git a/src/main.rs b/src/main.rs index fa94d93..118423d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use std::io::{stderr, stdout, Write}; use std::os::unix::ffi::OsStrExt; use anyhow::{bail, format_err, Error}; -use nix::sys::socket::SockAddr; +use nix::sys::socket::UnixAddr; #[macro_use] mod macros; @@ -117,7 +117,7 @@ async fn do_main(use_sd_notify: bool, socket_path: OsString) -> Result<(), Error } let address = - SockAddr::new_unix(socket_path.as_os_str()).expect("cannot create struct sockaddr_un?"); + UnixAddr::new(socket_path.as_os_str()).expect("cannot create struct sockaddr_un?"); let mut listener = SeqPacketListener::bind(&address) .map_err(|e| format_err!("failed to create listening socket: {}", e))?; diff --git a/src/syscall.rs b/src/syscall.rs index 76e63d6..b825f06 100644 --- a/src/syscall.rs +++ b/src/syscall.rs @@ -76,7 +76,7 @@ pub fn get_c_string(msg: &ProxyMessageBuffer, offset: u64) -> Result= got { - Err(nix::Error::Sys(Errno::EINVAL).into()) + Err(Errno::EINVAL.into()) } else { unsafe { data.set_len(len);