diff Modules/_posixsubprocess.c @ 68525:ead52adcd0c8 3.2

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.
author Gregory P. Smith <greg@krypto.org>
date Tue, 15 Mar 2011 14:56:39 -0400
parents a66a6e42538f
children 1140b32747c9 53ea5663b290
line wrap: on
line diff
--- a/Modules/_posixsubprocess.c	Tue Mar 15 20:22:50 2011 +0100
+++ b/Modules/_posixsubprocess.c	Tue Mar 15 14:56:39 2011 -0400
@@ -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));
     }