async-std
async-std copied to clipboard
impl IntoRawFd for TcpStream closes the fd
This code gets takes the TcpStream by value, gets its fd, and immediately destroys the TcpStream, likely destroying the fd:
impl IntoRawFd for TcpStream {
fn into_raw_fd(self) -> RawFd {
self.as_raw_fd()
}
}
It looks like the other impls of IntoRawFd do self.watcher.into_inner().into_raw_fd() which seems correct comparatively.
Even the documentation states that this would transfer ownership of the underlying fd. https://docs.rs/async-std/1.6.0/async_std/os/unix/io/trait.IntoRawFd.html.
Any updates?