From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id EE844385782E; Tue, 14 Sep 2021 15:07:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE844385782E Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: fix inheritence of select_sem on write side of pipe X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 0063ffeb739189b937097901cca4d5c67e8e5203 X-Git-Newrev: c48361ad9e84a3b8217111c03eda5d7820eebb2e Message-Id: <20210914150749.EE844385782E@sourceware.org> Date: Tue, 14 Sep 2021 15:07:49 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 15:07:50 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c48361ad9e84a3b8217111c03eda5d7820eebb2e commit c48361ad9e84a3b8217111c03eda5d7820eebb2e Author: Corinna Vinschen 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 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);