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: pipe, fifo: Call set_no_inheritance() for adjunct handles. Date: Tue, 14 Sep 2021 15:08:05 +0000 (GMT) [thread overview] Message-ID: <20210914150805.0FEDA385781F@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0d12015670a00b7ecb2db4f66368e863b68de13d commit 0d12015670a00b7ecb2db4f66368e863b68de13d Author: Takashi Yano <takashi.yano@nifty.ne.jp> Date: Tue Sep 14 12:49:35 2021 +0900 Cygwin: pipe, fifo: Call set_no_inheritance() for adjunct handles. - Currntly, set_no_inheritance() is not called for the adjunct handles such as select_sem. This patch fixes the issue. Diff: --- winsup/cygwin/fhandler.h | 1 + winsup/cygwin/fhandler_fifo.cc | 2 ++ winsup/cygwin/fhandler_pipe.cc | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 13fba9a14..46381c397 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1208,6 +1208,7 @@ public: void open_setup (int flags); void fixup_after_fork (HANDLE); int dup (fhandler_base *child, int); + void set_close_on_exec (bool val); int close (); void __reg3 raw_read (void *ptr, size_t& len); int ioctl (unsigned int cmd, void *); diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index aa89fa7ae..37498f547 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -1817,4 +1817,6 @@ fhandler_fifo::set_close_on_exec (bool val) set_no_inheritance (fc_handler[i].h, val); fifo_client_unlock (); } + if (select_sem) + set_no_inheritance (select_sem, val); } diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc index 70cfa3784..da473a1dc 100644 --- a/winsup/cygwin/fhandler_pipe.cc +++ b/winsup/cygwin/fhandler_pipe.cc @@ -515,6 +515,16 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len) return nbytes ?: -1; } +void +fhandler_pipe::set_close_on_exec (bool val) +{ + fhandler_base::set_close_on_exec (val); + if (read_mtx) + set_no_inheritance (read_mtx, val); + if (select_sem) + set_no_inheritance (select_sem, val); +} + void fhandler_pipe::fixup_after_fork (HANDLE parent) {
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=20210914150805.0FEDA385781F@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: linkBe 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).