Cygwin: pty: Prevent meaningless ResizePseudoConsole() calls.

- This patch prevents to call ResizePseudoConsole() unless the pty
  is resized.
This commit is contained in:
Takashi Yano via Cygwin-patches 2020-05-28 22:49:26 +09:00 committed by Ken Brown
parent fe59ac0da7
commit 896f6dc387
1 changed files with 9 additions and 9 deletions

View File

@ -2615,18 +2615,18 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
*(struct winsize *) arg = get_ttyp ()->winsize;
break;
case TIOCSWINSZ:
/* FIXME: Pseudo console can be accessed via its handle
only in the process which created it. What else can we do? */
if (get_pseudo_console () && get_ttyp ()->master_pid == myself->pid)
{
COORD size;
size.X = ((struct winsize *) arg)->ws_col;
size.Y = ((struct winsize *) arg)->ws_row;
ResizePseudoConsole (get_pseudo_console (), size);
}
if (get_ttyp ()->winsize.ws_row != ((struct winsize *) arg)->ws_row
|| get_ttyp ()->winsize.ws_col != ((struct winsize *) arg)->ws_col)
{
/* FIXME: Pseudo console can be accessed via its handle
only in the process which created it. What else can we do? */
if (get_pseudo_console () && get_ttyp ()->master_pid == myself->pid)
{
COORD size;
size.X = ((struct winsize *) arg)->ws_col;
size.Y = ((struct winsize *) arg)->ws_row;
ResizePseudoConsole (get_pseudo_console (), size);
}
get_ttyp ()->winsize = *(struct winsize *) arg;
get_ttyp ()->kill_pgrp (SIGWINCH);
}