]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pty: Fix handle leak in master process.
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Tue, 13 Feb 2024 02:17:46 +0000 (11:17 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Tue, 13 Feb 2024 14:36:05 +0000 (23:36 +0900)
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

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>
winsup/cygwin/fhandler/pty.cc
winsup/cygwin/release/3.5.1

index 3f4bc56b52a601efeee23e2fc86f44eb21abc39b..c5c7921443943b48ff515f4f464e0e417038a120 100644 (file)
@@ -3995,6 +3995,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,
index 81945dbda58a23c1ef998638e0f83cbe8b0d6ea4..715fcf74d480dd354a8bc2a9252aa9f42522583a 100644 (file)
@@ -12,3 +12,7 @@ Fixes:
   error mode is now possible by using the new CYGWIN environment variable
   option "winjitdebug".
   Addresses: https://cygwin.com/pipermail/cygwin/2024-February/255305.html
+
+- Fix handle leak in pty master which occurs when non-cygwin process
+  is started in pty.
+  Addresses: https://github.com/msys2/msys2-runtime/issues/198
This page took 0.037706 seconds and 5 git commands to generate.