From: Thomas Karpiniec Date: Fri, 28 Jun 2024 01:21:57 +0000 (+1000) Subject: Fix up linux build X-Git-Tag: v0.1.0~2 X-Git-Url: https://code.octet-stream.net/netwatcher/commitdiff_plain/91bdce994d6788c2c9a6b0488fd443615b1bcbe3?ds=sidebyside;hp=d080463c3c86ac4729f5e0d99332b8f556811755 Fix up linux build --- diff --git a/src/watch_linux.rs b/src/watch_linux.rs index dc99572..e49d629 100644 --- a/src/watch_linux.rs +++ b/src/watch_linux.rs @@ -11,9 +11,9 @@ use nix::sys::socket::socket; use nix::sys::socket::AddressFamily; use nix::sys::socket::MsgFlags; use nix::sys::socket::NetlinkAddr; +use nix::sys::socket::SockFlag; use nix::sys::socket::SockProtocol; use nix::sys::socket::SockType; -use nix::sys::socket::SOCK_NONBLOCK; use nix::unistd::pipe; use crate::Error; @@ -35,7 +35,7 @@ pub(crate) struct WatchHandle { impl Drop for WatchHandle { fn drop(&mut self) { drop(self.pipefd.take()); - let _ = self.complete.take().recv(); + let _ = self.complete.take().unwrap().recv(); } } @@ -55,11 +55,10 @@ fn start_watcher_thread( let sockfd = socket( AddressFamily::Netlink, SockType::Raw, - SOCK_NONBLOCK, + SockFlag::SOCK_NONBLOCK, Some(SockProtocol::NetlinkRoute), ) .map_err(|e| Error::CreateSocket(e.to_string()))?; - sockfd.set_nonblocking(true); let sa_nl = NetlinkAddr::new( 0, (RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR) as u32, @@ -124,5 +123,5 @@ fn start_watcher_thread( drop(complete_tx); }); - Ok(pipe_wr) + Ok((pipe_wr, complete_rx)) }