diff --git a/src/header/netdb/mod.rs b/src/header/netdb/mod.rs index bf2d2945e9..13ef149a79 100644 --- a/src/header/netdb/mod.rs +++ b/src/header/netdb/mod.rs @@ -239,7 +239,7 @@ pub unsafe extern "C" fn gethostbyaddr( H_ERRNO.set(NO_RECOVERY); return ptr::null_mut(); } - let addr: in_addr = unsafe { *(v as *mut in_addr) }; + let addr: in_addr = unsafe { (*(v as *mut in_addr)).clone() }; // check the hosts file first let mut p: *mut hostent; @@ -277,7 +277,7 @@ pub unsafe extern "C" fn gethostbyaddr( host_aliases.push(ptr::null_mut()); unsafe { HOST_ALIASES.unsafe_set(Some(_host_aliases)) }; - match lookup_addr(addr).map(|host_names| host_names.into_iter().next()) { + match lookup_addr(addr.clone()).map(|host_names| host_names.into_iter().next()) { Ok(Some(host_name)) => { unsafe { _HOST_ADDR_LIST = addr.s_addr.to_ne_bytes() }; unsafe { diff --git a/src/header/netinet_in/mod.rs b/src/header/netinet_in/mod.rs index 2155bedba6..2a7b6edf91 100644 --- a/src/header/netinet_in/mod.rs +++ b/src/header/netinet_in/mod.rs @@ -16,7 +16,7 @@ pub type in_port_t = u16; /// See . #[repr(C)] -#[derive(Debug, Clone, Copy, Default)] +#[derive(Debug, Clone, Default)] pub struct in_addr { pub s_addr: in_addr_t, }