Commit 9c4f44f7 authored by Gregory P. Smith's avatar Gregory P. Smith

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.
parent 9bb9877d
......@@ -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));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment