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: Fix deadlock if pipe is created by non-cygwin app. Date: Tue, 14 Sep 2021 15:07:44 +0000 (GMT) [thread overview] Message-ID: <20210914150744.E8E463857835@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0063ffeb739189b937097901cca4d5c67e8e5203 commit 0063ffeb739189b937097901cca4d5c67e8e5203 Author: Takashi Yano <takashi.yano@nifty.ne.jp> Date: Sun Sep 12 15:06:05 2021 +0900 Cygwin: pipe: Fix deadlock if pipe is created by non-cygwin app. Diff: --- winsup/cygwin/fhandler.h | 1 + winsup/cygwin/fhandler_pipe.cc | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index d309be2f7..13fba9a14 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1205,6 +1205,7 @@ public: select_record *select_except (select_stuff *); char *get_proc_fd_name (char *buf); int open (int flags, mode_t mode = 0); + void open_setup (int flags); void fixup_after_fork (HANDLE); int dup (fhandler_base *child, int); int close (); diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc index 6994a5dce..9b4255cfd 100644 --- a/winsup/cygwin/fhandler_pipe.cc +++ b/winsup/cygwin/fhandler_pipe.cc @@ -191,6 +191,19 @@ out: return 0; } +void +fhandler_pipe::open_setup (int flags) +{ + fhandler_base::open_setup (flags); + if (get_dev () == FH_PIPER && !read_mtx) + { + SECURITY_ATTRIBUTES *sa = sec_none_cloexec (flags); + read_mtx = CreateMutex (sa, FALSE, NULL); + if (!read_mtx) + debug_printf ("CreateMutex failed: %E"); + } +} + off_t fhandler_pipe::lseek (off_t offset, int whence) {
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=20210914150744.E8E463857835@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).