public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: fhandler_base::dup Reflect O_CLOEXEC to inheritance flag.
Date: Tue, 14 Sep 2021 15:08:00 +0000 (GMT)	[thread overview]
Message-ID: <20210914150800.08AF53858413@sourceware.org> (raw)

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

commit 3e80b12fde6126d85ae2ee58ba57e499c57b6c92
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Tue Sep 14 12:48:03 2021 +0900

    Cygwin: fhandler_base::dup Reflect O_CLOEXEC to inheritance flag.
    
    - Currently fhandler_base::dup duplicates handles with bInheritHandle
      TRUE unconditionally. This patch reflects O_CLOEXEC flag to that
      parameter.

Diff:
---
 winsup/cygwin/fhandler.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 39fe2640a..9dfe70be3 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1308,7 +1308,7 @@ fhandler_base::init (HANDLE f, DWORD a, mode_t bin)
 }
 
 int
-fhandler_base::dup (fhandler_base *child, int)
+fhandler_base::dup (fhandler_base *child, int flags)
 {
   debug_printf ("in fhandler_base dup");
 
@@ -1317,7 +1317,7 @@ fhandler_base::dup (fhandler_base *child, int)
     {
       if (!DuplicateHandle (GetCurrentProcess (), get_handle (),
 			    GetCurrentProcess (), &nh,
-			    0, TRUE, DUPLICATE_SAME_ACCESS))
+			    0, !(flags & O_CLOEXEC), DUPLICATE_SAME_ACCESS))
 	{
 	  debug_printf ("dup(%s) failed, handle %p, %E",
 			get_name (), get_handle ());


                 reply	other threads:[~2021-09-14 15:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210914150800.08AF53858413@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).