From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id DA56A3858C55; Sun, 8 May 2022 13:30:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA56A3858C55 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: Change the condition to send Ctrl-C event. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: 3c4ed01b18ef858de0bd1baaaa583c370ee00c12 X-Git-Newrev: 8ff0657295c2f15461d628cb23774f729226c88e Message-Id: <20220508133017.DA56A3858C55@sourceware.org> Date: Sun, 8 May 2022 13:30:17 +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, 08 May 2022 13:30:18 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D8ff0657295c= 2f15461d628cb23774f729226c88e commit 8ff0657295c2f15461d628cb23774f729226c88e Author: Takashi Yano Date: Sun May 8 22:04:38 2022 +0900 Cygwin: pty: Change the condition to send Ctrl-C event. =20 - Previously, non-cygwin app started by "script -c " receives Ctrl-C twice. This patch fixes the issue. Diff: --- winsup/cygwin/fhandler_termios.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_ter= mios.cc index 0bc360078..737bbea49 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -324,9 +324,6 @@ fhandler_termios::process_sigs (char c, tty* ttyp, fhan= dler_termios *fh) pid_t pgid =3D ttyp->pgid; =20 /* The name *_nat stands for 'native' which means non-cygwin apps. */ - pinfo leader (pgid); - bool cyg_leader =3D /* The process leader is a cygwin process. */ - leader && !(leader->process_state & PID_NOTCYGWIN); bool ctrl_c_event_sent =3D false; bool need_discard_input =3D false; bool pg_with_nat =3D false; /* The process group has non-cygwin processe= s. */ @@ -385,9 +382,9 @@ fhandler_termios::process_sigs (char c, tty* ttyp, fhan= dler_termios *fh) if ((p->process_state & PID_NEW_PG) && (p->process_state & PID_NOTCYGWIN)) GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT, p->dwProcessId); - else if ((!fh || fh->need_send_ctrl_c_event () || cyg_leader) - && !ctrl_c_event_sent) /* cyg_leader is needed by GDB - with non-cygwin inferior */ + else if ((!fh || fh->need_send_ctrl_c_event () + || p->exec_dwProcessId =3D=3D p->dwProcessId) + && !ctrl_c_event_sent) { GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0); ctrl_c_event_sent =3D true;