From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 574D13942003; Fri, 13 Mar 2020 09:56:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 574D13942003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1584093375; bh=hABsLRUhkG4+RklClFqvDDxMpGe36/vj5O3VwZSGSHY=; h=From:To:Subject:Date:From; b=NnuRx/yKSFuTMDwSVDzl+zSMgBy7LOnZqYviMbzCTZMvZcpVr7tCIHqD6LSSe4sKa wl/vBHkkM8DzAUSyt2n5yT0qlTk9cMXndAATa/pN+GVAVMJgfKFYe4aSqB0Qxx88Yy 9YqT1IY2XahiAg4b4Y7TdaKxeBJYHJfIkm9DmMVY= 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: Add FreeConsole to destructor of pty slave. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: 57a80207ff5f7045a45668cee827ce7f6906ccc8 X-Git-Newrev: 071b8e0cbd4be33449c12bb0d58f514ed8ef893c Message-Id: <20200313095615.574D13942003@sourceware.org> Date: Fri, 13 Mar 2020 09:56:15 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2020 09:56:15 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=071b8e0cbd4be33449c12bb0d58f514ed8ef893c commit 071b8e0cbd4be33449c12bb0d58f514ed8ef893c Author: Takashi Yano via Cygwin-patches Date: Fri Mar 13 12:06:49 2020 +0900 Cygwin: pty: Add FreeConsole to destructor of pty slave. - When pseudo console is closed, all the processes attched to the pseudo console are terminated. This causes the problem reported in https://sourceware.org/pipermail/cygwin/2020-March/244046.html. This patch fixes the issue. Diff: --- winsup/cygwin/fhandler_tty.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index b42e0aeb6..b2e725d5d 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -706,8 +706,15 @@ fhandler_pty_slave::fhandler_pty_slave (int unit) fhandler_pty_slave::~fhandler_pty_slave () { if (!get_ttyp ()) - /* Why comes here? Who clears _tc? */ - return; + { + /* Why comes here? Who clears _tc? */ + if (freeconsole_on_close) + { + FreeConsole (); + pcon_attached_to = -1; + } + return; + } if (get_pseudo_console ()) { int used = 0;