Skip to content

Commit

Permalink
Cygwin: pty: Fix handle leak in master process.
Browse files Browse the repository at this point in the history
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.

msys2#198

Fixes: 29431fc ("Cygwin: pty: Inherit typeahead data between two input pipes.")
Reported-by: Hakkin Lain
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
  • Loading branch information
tyan0 committed Feb 13, 2024
1 parent 70371d6 commit a6ac7b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions winsup/cygwin/fhandler/pty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions winsup/cygwin/release/3.5.1
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a6ac7b4

Please sign in to comment.