MSYS2-packages/msys2-runtime-3.4/0057-Cygwin-pty-Fix-handle-leak-in-master-process.patch
Johannes Schindelin e6209c6301 msys2-runtime-3.4: sync with the msys2-runtime-3.4.10 branch
Looks like we haven't updated `MSYS2-packages`' `msys2-runtime-3.4`
directory in quite a while. This roll-up integrates:

- https://github.com/msys2/msys2-runtime/pull/192
- https://github.com/msys2/msys2-runtime/pull/205
- https://github.com/msys2/msys2-runtime/pull/209
- https://github.com/msys2/msys2-runtime/pull/210
- https://github.com/msys2/msys2-runtime/pull/220

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2024-07-09 09:02:03 +02:00

33 lines
1.3 KiB
Diff

From f769444ad2f17709dfcb9c0067aa3b39b525abee Mon Sep 17 00:00:00 2001
From: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Tue, 13 Feb 2024 11:17:46 +0900
Subject: [PATCH 57/N] Cygwin: pty: Fix handle leak in master process.
If non-cygwin process is started in pty, closing from_master_nat
pipe handle was missing in fhandler_pty_slave::input_transfer().
This occured because the handle was duplicated but not closed.
https://github.com/msys2/msys2-runtime/issues/198
Backported-from: a6ac7b4138 (Cygwin: pty: Fix handle leak in master process., 2024-02-13)
Fixes: 29431fcb5b14 ("Cygwin: pty: Inherit typeahead data between two input pipes.")
Reported-by: Hakkin Lain
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/fhandler/pty.cc | 1 +
1 file changed, 1 insertion(+)
diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index dbeffc9..9d1a119 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -4066,6 +4066,7 @@ fhandler_pty_slave::transfer_input (tty::xfer_dir dir, HANDLE from, tty *ttyp,
transfered = true;;
}
}
+ CloseHandle (to);
/* Fix input_available_event which indicates availability in cyg pipe. */
if (dir == tty::to_nat) /* all data is transfered to nat pipe,