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.

#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>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
tyan0 authored and dscho committed Feb 13, 2024
1 parent ec35e8a commit c73fabb
Showing 1 changed file with 1 addition 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 @@ -4015,6 +4015,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

0 comments on commit c73fabb

Please sign in to comment.