[Python-checkins] cpython: Fix issue #11432. if the stdin pipe is the same file descriptor as either

gregory.p.smith python-checkins at python.org
Tue Mar 15 20:52:40 CET 2011


http://hg.python.org/cpython/rev/adcf03b074b7
changeset:   68520:adcf03b074b7
user:        Gregory P. Smith <greg at krypto.org>
date:        Tue Mar 15 14:56:39 2011 -0400
summary:
  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.

files:
  Modules/_posixsubprocess.c

diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c
--- a/Modules/_posixsubprocess.c
+++ b/Modules/_posixsubprocess.c
@@ -99,10 +99,10 @@
     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));
     }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list