X-Git-Url: https://code.octet-stream.net/netwatcher/blobdiff_plain/addb589bf51bdc5b5e253c0b5cbd47394e293ba7..422be212d60fe053ed9bcb14aad6d1059b3a2906:/src/watch_linux.rs diff --git a/src/watch_linux.rs b/src/watch_linux.rs index c1f08a2..e8e1ffc 100644 --- a/src/watch_linux.rs +++ b/src/watch_linux.rs @@ -44,13 +44,14 @@ fn start_watcher_thread( SockFlag::empty(), Some(SockProtocol::NetlinkRoute), ) - .map_err(|_| Error::Internal)?; // TODO: proper errors + .map_err(|e| Error::CreateSocket(e))?; + // TODO: set nonblocking let sa_nl = NetlinkAddr::new( 0, (RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR) as u32, ); - bind(sockfd.as_raw_fd(), &sa_nl).map_err(|_| Error::Internal)?; // TODO: proper errors - let (pipe_rd, pipe_wr) = pipe().map_err(|_| Error::Internal)?; + bind(sockfd.as_raw_fd(), &sa_nl).map_err(|e| Error::Bind(e))?; + let (pipe_rd, pipe_wr) = pipe().map_err(|e| Error::CreatePipe(e))?; let mut prev_list = List::default(); let mut handle_update = move |new_list: List| {