From 49d0c04260e7bca17cdaf48c5cc4dffea5e312ab Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 16 Jan 2004 22:54:14 +0000 Subject: [PATCH] * cygheap.cc (init_cygheap::close_ctty): Don't NULL ctty if it is still active. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/cygheap.cc | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b8fad2676..a92ce1b22 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2004-01-16 Christopher Faylor + + * cygheap.cc (init_cygheap::close_ctty): Don't NULL ctty if it is still + active. + 2004-01-16 Christopher Faylor * dtable.cc (dtable::vfork_parent_restore): Store ctty_on_hold prior to diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 0171f99f6..0e46c7317 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -176,10 +176,15 @@ void init_cygheap::close_ctty () { debug_printf ("closing cygheap->ctty %p", cygheap->ctty); + int usecount = cygheap->ctty->usecount; cygheap->ctty->close (); if (cygheap->ctty_on_hold == cygheap->ctty) cygheap->ctty_on_hold = NULL; - cygheap->ctty = NULL; + if (usecount == 1) + { + cygheap->ctty = NULL; + debug_printf ("setting cygheap->ctty to NULL"); + } } #define pagetrunc(x) ((void *) (((DWORD) (x)) & ~(4096 - 1)))