Merge branch 'inaddr-nocopy' into 'master'

do not derive Copy on in_addr struct

See merge request redox-os/relibc!1098
This commit is contained in:
Jeremy Soller
2026-03-17 05:51:05 -06:00
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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 {
+1 -1
View File
@@ -16,7 +16,7 @@ pub type in_port_t = u16;
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/netinet_in.h.html>.
#[repr(C)]
#[derive(Debug, Clone, Copy, Default)]
#[derive(Debug, Clone, Default)]
pub struct in_addr {
pub s_addr: in_addr_t,
}