public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: pty: Fix a bug in input transfer for GDB.
Date: Mon, 15 Feb 2021 12:06:04 +0000 (GMT)	[thread overview]
Message-ID: <20210215120604.10A88394BE3A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2b94fad48edf07490113ab5052f2a39cfccb43c9

commit 2b94fad48edf07490113ab5052f2a39cfccb43c9
Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>
Date:   Mon Feb 15 03:47:51 2021 +0900

    Cygwin: pty: Fix a bug in input transfer for GDB.
    
    - With this patch, not only NL but also CR is treated as a line end
      in the code checking if input transfer is necessary.

Diff:
---
 winsup/cygwin/fhandler_tty.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index f6eb3ae4d..5afede859 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -1181,7 +1181,7 @@ fhandler_pty_slave::mask_switch_to_pcon_in (bool mask, bool xfer)
   /* In GDB, transfer input based on setpgid() does not work because
      GDB may not set terminal process group properly. Therefore,
      transfer input here if isHybrid is set. */
-  if (get_ttyp ()->switch_to_pcon_in && !!masked != mask && xfer && isHybrid)
+  if (isHybrid && !!masked != mask && xfer)
     {
       if (mask && get_ttyp ()->pcon_input_state_eq (tty::to_nat))
 	{
@@ -1471,7 +1471,8 @@ wait_retry:
 out:
   termios_printf ("%d = read(%p, %lu)", totalread, ptr, len);
   len = (size_t) totalread;
-  mask_switch_to_pcon_in (false, totalread > 0 && ptr0[totalread - 1] == '\n');
+  bool saw_eol = totalread > 0 && strchr ("\r\n", ptr0[totalread -1]);
+  mask_switch_to_pcon_in (false, saw_eol);
 }
 
 int


                 reply	other threads:[~2021-02-15 12:06 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=20210215120604.10A88394BE3A@sourceware.org \
    --to=corinna@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: link
Be 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).