Skip to content

Commit

Permalink
Remove unnecessary unwrapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman S. Borschel authored and dvc94ch committed Jan 25, 2021
1 parent ead3648 commit 49ad2bf
Showing 1 changed file with 3 additions and 4 deletions.
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

0 comments on commit 49ad2bf

Please sign in to comment.