[newlib-cygwin] Cygwin: close_all_files: Do not duplicate stderr for write pipe.
Ken Brown
kbrown@sourceware.org
Thu Sep 16 15:41:04 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=350806f8825985d3a16b18c6f41476415f9dd7cf
commit 350806f8825985d3a16b18c6f41476415f9dd7cf
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Thu Sep 16 20:50:54 2021 +0900
Cygwin: close_all_files: Do not duplicate stderr for write pipe.
- Currently, the stderr handle is duplicated in close_all_files().
This interferes the handle counting for detecting closure of read
pipe, which is introduced by commit f79a4611. This patch stops
duplicating stderr handle if it is write pipe.
Diff:
---
winsup/cygwin/syscalls.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 11af079cb..a3ffe3532 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -95,7 +95,7 @@ close_all_files (bool norelease)
if (cfd >= 0)
{
debug_only_printf ("closing fd %d", i);
- if (i == 2)
+ if (i == 2 && cfd->get_dev () != FH_PIPEW)
DuplicateHandle (GetCurrentProcess (), cfd->get_output_handle (),
GetCurrentProcess (), &h,
0, false, DUPLICATE_SAME_ACCESS);
More information about the Cygwin-cvs
mailing list