From 91bdce994d6788c2c9a6b0488fd443615b1bcbe3 Mon Sep 17 00:00:00 2001
From: Thomas Karpiniec <tom.karpiniec@outlook.com>
Date: Fri, 28 Jun 2024 11:21:57 +1000
Subject: [PATCH] Fix up linux build

---
 src/watch_linux.rs | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

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<F: FnMut(Update) + Send + 'static>(
     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<F: FnMut(Update) + Send + 'static>(
         drop(complete_tx);
     });
 
-    Ok(pipe_wr)
+    Ok((pipe_wr, complete_rx))
 }
-- 
2.39.5