From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id E7580384BC14; Tue, 19 Jan 2021 09:57:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7580384BC14 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: Lessen the side effect of workaround for rlwarp. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: 59ccb3a00815cef8e4dd7b4b7b99980862de0476 X-Git-Newrev: 62e739b51bb1cbe644470c40ca414d8a2ea34c18 Message-Id: <20210119095720.E7580384BC14@sourceware.org> Date: Tue, 19 Jan 2021 09:57:20 +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 Jan 2021 09:57:21 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=62e739b51bb1cbe644470c40ca414d8a2ea34c18 commit 62e739b51bb1cbe644470c40ca414d8a2ea34c18 Author: Takashi Yano via Cygwin-patches Date: Tue Jan 19 18:27:02 2021 +0900 Cygwin: pty: Lessen the side effect of workaround for rlwarp. - This patch lessens the side effect of the workaround for rlwrap introduced by commit 4e16b033. Diff: --- winsup/cygwin/fhandler_tty.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 473c0c968..c78e996e8 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1176,11 +1176,19 @@ fhandler_pty_slave::tcgetattr (struct termios *t) { reset_switch_to_pcon (); *t = get_ttyp ()->ti; + /* Workaround for rlwrap */ - if (get_ttyp ()->pcon_start) - t->c_lflag &= ~(ICANON | ECHO); - if (get_ttyp ()->h_pseudo_console) - t->c_iflag &= ~ICRNL; + cygheap_fdenum cfd (false); + while (cfd.next () >= 0) + if (cfd->get_major () == DEV_PTYM_MAJOR + && cfd->get_minor () == get_minor ()) + { + if (get_ttyp ()->pcon_start) + t->c_lflag &= ~(ICANON | ECHO); + if (get_ttyp ()->h_pseudo_console) + t->c_iflag &= ~ICRNL; + break; + } return 0; }