Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
os/unix/stream: stop into_raw_fd from closing the fd
`UnixStream::into_raw_fd` calls `as_raw_fd`, which doesn't take the ownership of the file descriptor, so the file descriptor is closed when `self` is dropped upon returning from the function. Because `UnixStream` uses a `Arc` to support Clone, there could be an arbitrary number of instances around. We cannot take ownership of the descriptor from all of the instances. Therefore we have no choice but to duplicate the file descriptor and return that. Fixes #855 Signed-off-by: Yuxuan Shui <[email protected]>
- Loading branch information