From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 96A7B3972030; Thu, 28 May 2020 14:45:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96A7B3972030 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Prevent meaningless ResizePseudoConsole() calls. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: 25987b2c2a49013ce6d8c9d2ab29a92eb05f9482 X-Git-Newrev: b5089f339a2124f52dfe58c8e3c929e4c5634175 Message-Id: <20200528144504.96A7B3972030@sourceware.org> Date: Thu, 28 May 2020 14:45:04 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 May 2020 14:45:04 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b5089f339a2124f52dfe58c8e3c929e4c5634175 commit b5089f339a2124f52dfe58c8e3c929e4c5634175 Author: Takashi Yano via Cygwin-patches Date: Thu May 28 22:49:26 2020 +0900 Cygwin: pty: Prevent meaningless ResizePseudoConsole() calls. - This patch prevents to call ResizePseudoConsole() unless the pty is resized. Diff: --- winsup/cygwin/fhandler_tty.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index f29a2c214..b091765b3 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -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); }