Don't duplicate file descriptors into stdio fds
This commit is contained in:
parent
c2d140bd36
commit
0e0756cf0d
@ -104,7 +104,8 @@ impl BorrowedFd<'_> {
|
|||||||
#[cfg(target_os = "espidf")]
|
#[cfg(target_os = "espidf")]
|
||||||
let cmd = libc::F_DUPFD;
|
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) })
|
Ok(unsafe { OwnedFd::from_raw_fd(fd) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user