Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary unwrapping. #6

Merged
merged 1 commit into from
Jan 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/unix/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ impl NetlinkSocket {
address.nl_groups = RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;
let ptr = &mut address as *mut _;
let mut size = size_of!(sockaddr_nl) as u32;
errno!(libc::bind(fd.as_raw_fd(), ptr as *mut _, size)).unwrap();
errno!(libc::getsockname(fd.as_raw_fd(), ptr as *mut _, &mut size)).unwrap();
errno!(libc::bind(fd.as_raw_fd(), ptr as *mut _, size))?;
errno!(libc::getsockname(fd.as_raw_fd(), ptr as *mut _, &mut size))?;
let pid = address.nl_pid;
address.nl_pid = 0;
address.nl_groups = 0;
Expand Down Expand Up @@ -103,8 +103,7 @@ impl NetlinkSocket {
libc::MSG_NOSIGNAL,
address as _,
std::mem::size_of_val(&self.address) as _,
))
.unwrap();
))?;
Ok(())
})
.await
Expand Down