Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle’s std::os::unix::io::IntoRawFd implementation panics on stdin/stdout/stderr #55

Open
chris-morgan opened this issue Jan 13, 2022 · 1 comment

Comments

@chris-morgan
Copy link

This panics:

std::os::unix::io::IntoRawFd::into_raw_fd(same_file::Handle::stdin().unwrap())

The Option<File> field is treated carelessly, and so the reassuring “unwrapping won’t panic” comment in the Drop implementation is wrong.

Really, Option is the wrong tool to use here; it should be ManuallyDrop these days (✓ available within the current MSRV).

@chris-morgan
Copy link
Author

(I found this as part of a detailed review.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant