update to nix 0.24
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
bd5301dc58
commit
b8cb8723bd
@ -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" ] }
|
||||
|
@ -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::<nix::errno::Errno>() {
|
||||
SyscallStatus::Err(*errno as _)
|
||||
} else if let Some(nix::Error::Sys(errno)) = err.downcast_ref::<nix::Error>() {
|
||||
if let Some(errno) = err.downcast_ref::<nix::Error>() {
|
||||
SyscallStatus::Err(*errno as _)
|
||||
} else if let Some(ioerr) = err.downcast_ref::<std::io::Error>() {
|
||||
if let Some(errno) = ioerr.raw_os_error() {
|
||||
|
@ -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<Self, Error> {
|
||||
pub fn bind(address: &dyn SockaddrLike) -> Result<Self, Error> {
|
||||
let fd = seq_packet_socket(SockFlag::empty())?;
|
||||
socket::bind(fd.as_raw_fd(), address)?;
|
||||
socket::listen(fd.as_raw_fd(), 16)?;
|
||||
|
@ -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))?;
|
||||
|
@ -76,7 +76,7 @@ pub fn get_c_string(msg: &ProxyMessageBuffer, offset: u64) -> Result<CString, Er
|
||||
|
||||
let len = unsafe { libc::strnlen(data.as_ptr() as *const _, got) };
|
||||
if len >= got {
|
||||
Err(nix::Error::Sys(Errno::EINVAL).into())
|
||||
Err(Errno::EINVAL.into())
|
||||
} else {
|
||||
unsafe {
|
||||
data.set_len(len);
|
||||
|
Loading…
Reference in New Issue
Block a user