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: pipes: do not duplicate sec_none{_nih} locally when creating objects Date: Tue, 14 Sep 2021 15:07:55 +0000 (GMT) [thread overview] Message-ID: <20210914150755.0496E385781A@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8985f1c7c4d621498642e1c0fd349a5526006de4 commit 8985f1c7c4d621498642e1c0fd349a5526006de4 Author: Corinna Vinschen <corinna@vinschen.de> Date: Mon Sep 13 22:02:51 2021 +0200 Cygwin: pipes: do not duplicate sec_none{_nih} locally when creating objects We already fetched the correct SECURITY_ATTRIBUTES at the start of fhandler_pipe::create, so using another SECURITY_ATTRIBUTES object for the mutex and semaphore objects doesn't make much sense. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/fhandler_pipe.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc index 62cb1c0ec..70cfa3784 100644 --- a/winsup/cygwin/fhandler_pipe.cc +++ b/winsup/cygwin/fhandler_pipe.cc @@ -769,11 +769,7 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode) unique_id); /* For the read side of the pipe, add a mutex. See raw_read for the usage. */ - SECURITY_ATTRIBUTES sa = { .nLength = sizeof (SECURITY_ATTRIBUTES), - .lpSecurityDescriptor = NULL, - .bInheritHandle = !(mode & O_CLOEXEC) - }; - HANDLE mtx = CreateMutexW (&sa, FALSE, NULL); + HANDLE mtx = CreateMutexW (sa, FALSE, NULL); if (!mtx) { delete fhs[0]; @@ -786,11 +782,11 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode) fhs[0]->set_read_mutex (mtx); res = 0; } - fhs[0]->select_sem = CreateSemaphore (&sa, 0, INT32_MAX, NULL); + fhs[0]->select_sem = CreateSemaphore (sa, 0, INT32_MAX, NULL); if (fhs[0]->select_sem) DuplicateHandle (GetCurrentProcess (), fhs[0]->select_sem, GetCurrentProcess (), &fhs[1]->select_sem, - 0, !(mode & O_CLOEXEC), DUPLICATE_SAME_ACCESS); + 0, sa->bInheritHandle, DUPLICATE_SAME_ACCESS); } debug_printf ("%R = pipe([%p, %p], %d, %y)", res, fhs[0], fhs[1], psize, mode);
reply other threads:[~2021-09-14 15:07 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=20210914150755.0496E385781A@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).