[newlib-cygwin] Cygwin: pty: Fix write data handling in pcon_start phase
Takashi Yano via Cygwin-cvs <[email protected]> Mon, 6 Apr 2026 12:18:53 +0000 (GMT)
| Newsgroups | gmane.os.cygwin.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dc8bbec4c551= f9b606305d87a165909facf442e0b commit c8bbec4c551f9b606305d87a165909facf442e0b Author: Takashi Yano <[email protected]> Date: Wed Mar 25 19:32:16 2026 +0900 Cygwin: pty: Fix write data handling in pcon_start phase =20 If the 'for' loop in pcon_start handling in master write() does not break, 'ptr' and 'len' loose the chance to fixup the value. In this case, all data in 'ptr' are processed, so the 'len' should be 0. 1 byte is consistently consumed in each iteration in the 'for' loop, so this patch fixups 'ptr' and 'len' in every iterations instead of fixing-up at break. =20 Fixes: 9d7440036580 ("Cygwin: pty: Fix handling of data after CSI6n res= ponse") Signed-off-by: Takashi Yano <[email protected]> Reviewed-by: Johannes Schindelin <[email protected]> Diff: --- winsup/cygwin/fhandler/pty.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc index 60b8256f4..3c6b90ef5 100644 --- a/winsup/cygwin/fhandler/pty.cc +++ b/winsup/cygwin/fhandler/pty.cc @@ -2235,6 +2235,8 @@ fhandler_pty_master::write (const void *ptr, size_t l= en) } else line_edit (p + i, 1, ti, &ret); + len =3D orig_len - i - 1; + ptr =3D p + i + 1; if (state =3D=3D 1 && p[i] =3D=3D 'R') state =3D 2; if (state =3D=3D 2) @@ -2244,8 +2246,6 @@ fhandler_pty_master::write (const void *ptr, size_t l= en) the response sequence should not be written. */ if (!get_ttyp ()->req_xfer_input) WriteFile (to_slave_nat, wpbuf, ixput, &n, NULL); - len =3D orig_len - i - 1; - ptr =3D p + i + 1; ixput =3D 0; state =3D 0; get_ttyp ()->req_xfer_input =3D false;