public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: close_all_files: Do not duplicate stderr for write pipe.
@ 2021-09-16 15:41 Ken Brown
  0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2021-09-16 15:41 UTC (permalink / raw)
  To: cygwin-cvs

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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-16 15:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 15:41 [newlib-cygwin] Cygwin: close_all_files: Do not duplicate stderr for write pipe Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).