Rollup merge of #101426 - beetrees:dup-no-stdio, r=thomcc
Don't duplicate file descriptors into stdio fds Ensures that file descriptors are never duplicated into the stdio fds even if a stdio fd has been closed.
This commit is contained in:
commit
c6f6b1821d
@ -104,7 +104,8 @@ impl BorrowedFd<'_> {
|
||||
#[cfg(target_os = "espidf")]
|
||||
let cmd = libc::F_DUPFD;
|
||||
|
||||
let fd = cvt(unsafe { libc::fcntl(self.as_raw_fd(), cmd, 0) })?;
|
||||
// Avoid using file descriptors below 3 as they are used for stdio
|
||||
let fd = cvt(unsafe { libc::fcntl(self.as_raw_fd(), cmd, 3) })?;
|
||||
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user