Closed
Description
I noticed that libstd/sys/unix/fd.rs has this code:
#[cfg(target_env = "newlib")]
pub fn set_cloexec(&self) {
unsafe {
let previous = libc::fnctl(self.fd, libc::F_GETFD);
let ret = libc::fnctl(self.fd, libc::F_SETFD, previous | libc::FD_CLOEXEC);
debug_assert_eq!(ret, 0);
}
}
I'm pretty sure that should be fcntl
("file control"), not fnctl
: the call is consistent with the use of fcntl
on other UNIXes, and as far as I can tell, the newlib git repo defines fcntl
but not fnctl
. This would need to be fixed in both libstd and liblibc.
But there's an explicit mention of this code in the PR introducing it (#29289), and I'm sort of surprised that this would link if it were misspelled, let alone work, so maybe I'm missing something? If this is correct, a comment would be nice. :)
Metadata
Metadata
Assignees
Labels
No labels