From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97029 invoked by alias); 17 Jan 2020 09:21:30 -0000 Mailing-List: contact cygwin-cvs-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-cvs-owner@cygwin.com Received: (qmail 96983 invoked by uid 9078); 17 Jan 2020 09:21:30 -0000 Date: Fri, 17 Jan 2020 09:21:00 -0000 Message-ID: <20200117092130.96981.qmail@sourceware.org> 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: Fix state mismatch caused in octave gui. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 50e2a63b04bdd018484605fbb954fd1bd5147fa0 X-Git-Newrev: 7e6c96d6e1485b52b4243d0cd9699f2063645660 X-SW-Source: 2020-q1/txt/msg00015.txt https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7e6c96d6e1485b52b4243d0cd9699f2063645660 commit 7e6c96d6e1485b52b4243d0cd9699f2063645660 Author: Takashi Yano Date: Thu Jan 16 20:04:47 2020 +0900 Cygwin: pty: Fix state mismatch caused in octave gui. - In octave gui, sometimes state mismatch between real pty state and state variable occurs. For example, this occurs when 'ls' command is executed in octave gui. This patch fixes the issue. Diff: --- winsup/cygwin/spawn.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 08d52bb..f7c6dd5 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -947,6 +947,15 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, { FreeConsole (); AttachConsole (pid_restore); + cygheap_fdenum cfd (false); + int fd; + while ((fd = cfd.next ()) >= 0) + if (cfd->get_major () == DEV_PTYS_MAJOR) + { + fhandler_pty_slave *ptys = + (fhandler_pty_slave *) (fhandler_base *) cfd; + ptys->fixup_after_attach (false, fd); + } } return (int) res;