[newlib-cygwin] Cygwin: pty: Clear discard_input flag on master write()

Takashi Yano tyan0@sourceware.org
Wed Mar 25 21:32:40 GMT 2026


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

commit 50a87729d603cf7bf959f8cffc80371527a0537a
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Fri Mar 20 02:37:48 2026 +0900

    Cygwin: pty: Clear discard_input flag on master write()
    
    Currently, the first transfer_input() after Ctrl-C does not work
    because discard_input flag remains asserted. This can cause loosing
    typeahead input for non-cygwin app after Ctrl-C. With this patch,
    the discard_input flag is cleared on master write() because the
    input is new valid input after discarding input.
    
    Fixes: 4e16e575db04 ("Cygwin: pty: Discard input already accepted on interrupt.")
    Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
    Reviewed-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler/pty.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index 9ea9e80ef..8c290eb59 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -2149,6 +2149,8 @@ fhandler_pty_master::write (const void *ptr, size_t len)
 
   push_process_state process_state (PID_TTYOU);
 
+  get_ttyp ()->discard_input = false;
+
   if (get_ttyp ()->pcon_start)
     { /* Reaches here when pseudo console initialization is on going. */
       /* Pseudo condole support uses "CSI6n" to get cursor position.


More information about the Cygwin-cvs mailing list