summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>2021-02-15 03:47:51 +0900
committerCorinna Vinschen <corinna@vinschen.de>2021-02-15 13:05:56 +0100
commit2b94fad48edf07490113ab5052f2a39cfccb43c9 (patch)
treee1193a8eebd5a13232638beae5a7636cdf32937d
parentf206417894273ef73c7bca0f00213866945d8b4d (diff)
downloadcygnal-2b94fad48edf07490113ab5052f2a39cfccb43c9.tar.gz
cygnal-2b94fad48edf07490113ab5052f2a39cfccb43c9.tar.bz2
cygnal-2b94fad48edf07490113ab5052f2a39cfccb43c9.zip
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.
-rw-r--r--winsup/cygwin/fhandler_tty.cc5
1 files 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