From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 47DF0385841F; Sun, 13 Feb 2022 15:18:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47DF0385841F Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_3-branch] Cygwin: pty: Discard input in from_master_nat pipe on signal as well. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: 9c8a9a1b73af50b943789dbda2f3db610be3e0cd X-Git-Newrev: 77247c077b3334dc987d3f7269d42b75807abcf3 Message-Id: <20220213151805.47DF0385841F@sourceware.org> Date: Sun, 13 Feb 2022 15:18:05 +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: Sun, 13 Feb 2022 15:18:05 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D77247c077b3= 334dc987d3f7269d42b75807abcf3 commit 77247c077b3334dc987d3f7269d42b75807abcf3 Author: Takashi Yano Date: Sun Feb 13 02:16:32 2022 +0900 Cygwin: pty: Discard input in from_master_nat pipe on signal as well. =20 - Currently, pty discards input only in from_master pipe on signal. Due to this, if pty is started without pseudo console support and start a non-cygwin process from cmd.exe, type adhead input is not discarded on signals such as Ctrl-C. This patch fixes the issue. Diff: --- winsup/cygwin/fhandler_tty.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 7e733e49a..8c9a10c23 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -438,6 +438,9 @@ fhandler_pty_master::discard_input () while (::bytes_available (bytes_in_pipe, from_master) && bytes_in_pipe) ReadFile (from_master, buf, sizeof(buf), &n, NULL); ResetEvent (input_available_event); + if (!get_ttyp ()->pcon_activated) + while (::bytes_available (bytes_in_pipe, from_master_nat) && bytes_in_= pipe) + ReadFile (from_master_nat, buf, sizeof(buf), &n, NULL); get_ttyp ()->discard_input =3D true; ReleaseMutex (input_mutex); }