diff --git a/changelog/2456.fixed.md b/changelog/2456.fixed.md new file mode 100644 index 0000000000..ee877037eb --- /dev/null +++ b/changelog/2456.fixed.md @@ -0,0 +1 @@ +Fix cmsg_len() return type on OpenHarmony \ No newline at end of file diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 1f1869e90d..cb7618a932 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -1169,13 +1169,13 @@ impl<'a> ControlMessage<'a> { /// The value of CMSG_LEN on this message. /// Safe because CMSG_LEN is always safe #[cfg(any(target_os = "android", - all(target_os = "linux", not(target_env = "musl"))))] + all(target_os = "linux", not(any(target_env = "musl", target_env = "ohos")))))] fn cmsg_len(&self) -> usize { unsafe{CMSG_LEN(self.len() as libc::c_uint) as usize} } #[cfg(not(any(target_os = "android", - all(target_os = "linux", not(target_env = "musl")))))] + all(target_os = "linux", not(any(target_env = "musl", target_env = "ohos"))))))] fn cmsg_len(&self) -> libc::c_uint { unsafe{CMSG_LEN(self.len() as libc::c_uint)} }