bytecodealliance / rustix

Safe Rust bindings to POSIX-ish APIs
Other
1.46k stars 152 forks source link

Fix `dup2_stdout` et al to handle fd aliasing. #1069

Closed sunfishcode closed 3 months ago

sunfishcode commented 4 months ago

Fix dup2_stdout et al to work in the case where the file descriptor they are passed is the same as the file descriptor they implicitly operate on, including on targets that don't have a dup2 syscall and implement it using dup3, such as aarch64.

Fixes #1067.