diff options
author | Gregory P. Smith <greg@krypto.org> | 2011-03-15 18:56:39 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2011-03-15 18:56:39 (GMT) |
commit | 8121898ec5a206367186bdaf7c9b13bebc28bf57 (patch) | |
tree | 2a035146e841f4b9c1f0f687f58008815456334b /Modules/_posixsubprocess.c | |
parent | 112bb3ac6abc28d5e982019d667613ab168ad8d1 (diff) | |
download | cpython-8121898ec5a206367186bdaf7c9b13bebc28bf57.zip cpython-8121898ec5a206367186bdaf7c9b13bebc28bf57.tar.gz cpython-8121898ec5a206367186bdaf7c9b13bebc28bf57.tar.bz2 |
Fix issue #11432. if the stdin pipe is the same file descriptor as either stdout or stderr
in the _posixsubprocess C extension module it would unintentionally close the fds and raise
an error.
Diffstat (limited to 'Modules/_posixsubprocess.c')
-rw-r--r-- | Modules/_posixsubprocess.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index 0f85da9..bf10cbb 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -99,10 +99,10 @@ static void child_exec(char *const exec_array[], if (p2cread > 2) { POSIX_CALL(close(p2cread)); } - if (c2pwrite > 2) { + if (c2pwrite > 2 && c2pwrite != p2cread) { POSIX_CALL(close(c2pwrite)); } - if (errwrite != c2pwrite && errwrite > 2) { + if (errwrite != c2pwrite && errwrite != p2cread && errwrite > 2) { POSIX_CALL(close(errwrite)); } |