Skip to content

Commit 4ee7a85

Browse files
committed
Fix MSG_CMSG_CLOEXEC for macos
1 parent b50153d commit 4ee7a85

File tree

1 file changed

+18
-0
lines changed
  • library/std/src/sys/unix

1 file changed

+18
-0
lines changed

library/std/src/sys/unix/net.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ impl Socket {
237237
self.recv_from_with_flags(buf, 0)
238238
}
239239

240+
#[cfg(any(
241+
target_os = "android",
242+
target_os = "dragonfly",
243+
target_os = "emscripten",
244+
target_os = "freebsd",
245+
target_os = "linux",
246+
target_os = "netbsd",
247+
target_os = "openbsd",
248+
))]
240249
pub fn recv_msg(&self, msg: &mut libc::msghdr) -> io::Result<usize> {
241250
let n = cvt(unsafe { libc::recvmsg(self.0.raw(), msg, libc::MSG_CMSG_CLOEXEC) })?;
242251
Ok(n as usize)
@@ -259,6 +268,15 @@ impl Socket {
259268
self.0.is_write_vectored()
260269
}
261270

271+
#[cfg(any(
272+
target_os = "android",
273+
target_os = "dragonfly",
274+
target_os = "emscripten",
275+
target_os = "freebsd",
276+
target_os = "linux",
277+
target_os = "netbsd",
278+
target_os = "openbsd",
279+
))]
262280
pub fn send_msg(&self, msg: &mut libc::msghdr) -> io::Result<usize> {
263281
let n = cvt(unsafe { libc::sendmsg(self.0.raw(), msg, 0) })?;
264282
Ok(n as usize)

0 commit comments

Comments
 (0)