public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: fix inheritence of select_sem on write side of pipe
@ 2021-09-14 15:07 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-09-14 15:07 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c48361ad9e84a3b8217111c03eda5d7820eebb2e

commit c48361ad9e84a3b8217111c03eda5d7820eebb2e
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Sep 13 19:33:56 2021 +0200

    Cygwin: fix inheritence of select_sem on write side of pipe
    
    select_sem gets created on the read side with inheritence settings
    depending on the O_CLOEXEC flag.  Then it gets duplicated to the write
    side with unconditional inheritence.  Fix that.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler_pipe.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc
index 9b4255cfd..62cb1c0ec 100644
--- a/winsup/cygwin/fhandler_pipe.cc
+++ b/winsup/cygwin/fhandler_pipe.cc
@@ -790,7 +790,7 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode)
       if (fhs[0]->select_sem)
 	DuplicateHandle (GetCurrentProcess (), fhs[0]->select_sem,
 			 GetCurrentProcess (), &fhs[1]->select_sem,
-			 0, 1, DUPLICATE_SAME_ACCESS);
+			 0, !(mode & O_CLOEXEC), DUPLICATE_SAME_ACCESS);
     }
 
   debug_printf ("%R = pipe([%p, %p], %d, %y)", res, fhs[0], fhs[1], psize, mode);


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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 15:07 [newlib-cygwin] Cygwin: fix inheritence of select_sem on write side of pipe Corinna Vinschen

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