public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Takashi Yano <tyan0@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: ctty: Add missing fixup_after_{exec,fork}() call. Date: Tue, 7 Mar 2023 02:38:00 +0000 (GMT) [thread overview] Message-ID: <20230307023800.9E7B13858D39@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=523985b31e5ed6318705a30525716187d758bc2f commit 523985b31e5ed6318705a30525716187d758bc2f Author: Takashi Yano <takashi.yano@nifty.ne.jp> Date: Tue Mar 7 00:13:55 2023 +0900 Cygwin: ctty: Add missing fixup_after_{exec,fork}() call. Previously, fixup_after_{exec,fork}() calls for CTTY were missing. This patch fixes that. Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> Diff: --- winsup/cygwin/dtable.cc | 5 +++++ winsup/cygwin/fhandler/console.cc | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index 6b2394814..8ebd7b211 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -913,6 +913,8 @@ dtable::fixup_after_exec () else if (i <= 2) SetStdHandle (std_consts[i], fh->get_output_handle ()); } + if (cygheap->ctty) + cygheap->ctty->fixup_after_exec (); } void @@ -939,6 +941,9 @@ dtable::fixup_after_fork (HANDLE parent) else if (i <= 2) SetStdHandle (std_consts[i], fh->get_output_handle ()); } + + if (cygheap->ctty) + cygheap->ctty->fixup_after_fork (parent); } static void diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc index 0cbfe4ea4..23e733e94 100644 --- a/winsup/cygwin/fhandler/console.cc +++ b/winsup/cygwin/fhandler/console.cc @@ -723,6 +723,7 @@ fhandler_console::set_unit () pc.file_attributes (FILE_ATTRIBUTE_NORMAL); else { + _tc = NULL; set_handle (NULL); set_output_handle (NULL); created = false; @@ -4251,6 +4252,12 @@ fhandler_console::fixup_after_fork_exec (bool execing) set_unit (); setup_io_mutex (); wpbuf.init (); + if (cygheap->ctty == this && !get_handle () && !get_output_handle ()) + { + close_with_arch (); + cygheap->ctty = NULL; + return; + } if (!execing) return;
reply other threads:[~2023-03-07 2:38 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=20230307023800.9E7B13858D39@sourceware.org \ --to=tyan0@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).