From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 20C473840C10; Tue, 19 May 2020 13:28:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20C473840C10 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Make system_printf() work after closing pty slave. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: 7659ff0f5afd751f42485f2684c799c5f37b0fb9 X-Git-Newrev: 0365031ce1347600d854a23f30f1355745a1765c Message-Id: <20200519132839.20C473840C10@sourceware.org> Date: Tue, 19 May 2020 13:28:39 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 May 2020 13:28:39 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0365031ce1347600d854a23f30f1355745a1765c commit 0365031ce1347600d854a23f30f1355745a1765c Author: Takashi Yano via Cygwin-patches Date: Tue May 19 20:35:59 2020 +0900 Cygwin: pty: Make system_printf() work after closing pty slave. - Current pty cannot show system_printf() output after closing pty slave. This patch fixes the issue. Diff: --- winsup/cygwin/fhandler_tty.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 5a1bcd3ce..02b78cd2c 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -948,6 +948,10 @@ fhandler_pty_slave::open (int flags, mode_t) init_console_handler (true); } + get_ttyp ()->pcon_pid = 0; + get_ttyp ()->switch_to_pcon_in = false; + get_ttyp ()->switch_to_pcon_out = false; + set_open_status (); return 1; @@ -1008,6 +1012,7 @@ fhandler_pty_slave::close () termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex); if (pcon_attached_to == get_minor ()) get_ttyp ()->num_pcon_attached_slaves --; + set_switch_to_pcon (2); /* Make system_printf() work after close. */ return 0; }