summaryrefslogtreecommitdiff
path: root/src/sys/socket/mod.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2021-04-04 08:39:05 -0600
committerAlan Somers <asomers@gmail.com>2021-04-04 08:39:05 -0600
commit987c8a607b7b5b12660efeb50376ccce6b17e9a6 (patch)
treeb084ae56e100fcadae36acce9cbac1dc91d3d24a /src/sys/socket/mod.rs
parent6af11c1e70b02e1af36fdc339238d3a117fd3a94 (diff)
downloadnix-987c8a607b7b5b12660efeb50376ccce6b17e9a6.zip
Use memoffset::offset_of instead of homegrown macro
The homegrown macro was fine in 2016, but at some point it technically became UB. The memoffset crate does the same thing, but avoids UB when using rustc 1.51.0 or later. Fixes #1415
Diffstat (limited to 'src/sys/socket/mod.rs')
-rw-r--r--src/sys/socket/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs
index 2725e57c..4301ee1f 100644
--- a/src/sys/socket/mod.rs
+++ b/src/sys/socket/mod.rs
@@ -5,6 +5,7 @@ use cfg_if::cfg_if;
use crate::{Error, Result, errno::Errno};
use libc::{self, c_void, c_int, iovec, socklen_t, size_t,
CMSG_FIRSTHDR, CMSG_NXTHDR, CMSG_DATA, CMSG_LEN};
+use memoffset::offset_of;
use std::{mem, ptr, slice};
use std::os::unix::io::RawFd;
use crate::sys::time::TimeVal;