summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2011-03-15 18:56:39 (GMT)
committerGregory P. Smith <greg@krypto.org>2011-03-15 18:56:39 (GMT)
commit9c4f44f70acadd70fcdb0a0d5d66cefbc9da20bf (patch)
tree4968708fc96039003a2c7ae13ad8756cc11cc034
parent9bb9877d8079ccfc4f5b5448ba111392140112e4 (diff)
downloadcpython-9c4f44f70acadd70fcdb0a0d5d66cefbc9da20bf.zip
cpython-9c4f44f70acadd70fcdb0a0d5d66cefbc9da20bf.tar.gz
cpython-9c4f44f70acadd70fcdb0a0d5d66cefbc9da20bf.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.
-rw-r--r--Modules/_posixsubprocess.c4
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));
}