From a0ad40530fd0ac9926110a8c218f9637b6cd5c18 Mon Sep 17 00:00:00 2001 From: cgf 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 b8fad26768..a92ce1b22c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,10 @@ 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 calling close_all_files since it will be zeroed. diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 0171f99f68..0e46c73170 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))) -- 2.11.0