[newlib-cygwin] Cygwin: pty: Do not call empty WriteFile() to to_slave_nat
Takashi Yano via Cygwin-cvs <[email protected]> Tue, 3 Mar 2026 11:06:14 +0000 (GMT)
| Newsgroups | gmane.os.cygwin.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e2f429c67ab68b3f236c44e30615864dae718d57 commit e2f429c67ab68b3f236c44e30615864dae718d57 Author: Takashi Yano <[email protected]> Date: Sun Mar 1 03:59:11 2026 +0900 Cygwin: pty: Do not call empty WriteFile() to to_slave_nat In Windows 11, it seems that conhost.exe crashes on WriteFile() of zero-length data to to_slave_nat. This patch skip WriteFile() if the data length is 0. Signed-off-by: Takashi Yano <[email protected]> Reviewed-by: Johannes Schindelin <[email protected]> Diff: --- winsup/cygwin/fhandler/pty.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc index 838be4a2b..88a3d1cfe 100644 --- a/winsup/cygwin/fhandler/pty.cc +++ b/winsup/cygwin/fhandler/pty.cc @@ -2257,7 +2257,8 @@ fhandler_pty_master::write (const void *ptr, size_t len) } DWORD n; - WriteFile (to_slave_nat, buf, nlen, &n, NULL); + if (nlen) + WriteFile (to_slave_nat, buf, nlen, &n, NULL); ReleaseMutex (input_mutex); return len;