public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: FIFO: respect the O_CLOEXEC flag Date: Tue, 28 May 2019 20:15:00 -0000 [thread overview] Message-ID: <20190528201524.7605.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d79aa0f5939be2640b90971d022b98054b86d249 commit d79aa0f5939be2640b90971d022b98054b86d249 Author: Ken Brown <kbrown@cornell.edu> Date: Tue May 28 15:50:05 2019 -0400 Cygwin: FIFO: respect the O_CLOEXEC flag Set the inheritance of the Windows pipe handles according to the O_CLOEXEC flag. Previously the pipe was always created and opened with OBJ_INHERIT. Diff: --- winsup/cygwin/fhandler_fifo.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 3fabbc3..c9ff0a3 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -176,7 +176,7 @@ fhandler_fifo::create_pipe_instance (bool first) access = GENERIC_READ | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; - hattr = OBJ_INHERIT; + hattr = openflags & O_CLOEXEC ? 0 : OBJ_INHERIT; if (first) hattr |= OBJ_CASE_INSENSITIVE; InitializeObjectAttributes (&attr, get_pipe_name (), @@ -209,7 +209,8 @@ fhandler_fifo::open_pipe (HANDLE& ph) if (!NT_SUCCESS (status)) return status; access = GENERIC_WRITE | SYNCHRONIZE; - InitializeObjectAttributes (&attr, get_pipe_name (), OBJ_INHERIT, + InitializeObjectAttributes (&attr, get_pipe_name (), + openflags & O_CLOEXEC ? 0 : OBJ_INHERIT, npfsh, NULL); sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; status = NtOpenFile (&ph, access, &attr, &io, sharing, 0);
reply other threads:[~2019-05-28 20:15 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=20190528201524.7605.qmail@sourceware.org \ --to=kbrown@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).