aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/cygheap.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-03-16 02:57:37 +0000
committerChristopher Faylor <me@cgf.cx>2006-03-16 02:57:37 +0000
commit974f27a51acaa16269541985e22ee7590ba49670 (patch)
tree88561981b54b1c8012c6b9ed255b54cffe78bef1 /winsup/cygwin/cygheap.cc
parent490cfb83e99515e5b5573ab74d73f15c582da1b6 (diff)
downloadnewlib-974f27a51acaa16269541985e22ee7590ba49670.zip
newlib-974f27a51acaa16269541985e22ee7590ba49670.tar.gz
newlib-974f27a51acaa16269541985e22ee7590ba49670.tar.bz2
* cygheap.cc (init_cygheap::manage_console_count): Turn console control handler
on/off depending on whether we have allocated a console or not. * dcrt0.cc (child_info_fork::fork_retry): Add more potential retry statuses. (dll_crt0_0): Turn on/off console control depending on whether we have a controlling tty or not. * exceptions.cc (init_console_handler): Change BOOL to bool. * fhandler_console.cc (fhandler_console::need_invisible): Cosmetic change. * winsup.h (init_console_handler): Reflect argument type change. * wincap.h (supports_setconsolectrlhandler_null): Remove duplicate capability throughout. * wincap.cc: Ditto.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r--winsup/cygwin/cygheap.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 122e620..0c555e3 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -93,13 +93,16 @@ cygheap_fixup_in_child (bool execed)
int
init_cygheap::manage_console_count (const char *something, int amount, bool avoid_freeing_console)
{
+ if (console_count == 0 && amount > 0)
+ init_console_handler (true);
console_count += amount;
debug_printf ("%s: console_count %d, amount %d, %s, avoid_freeing_console %d",
something, console_count, amount, myctty (), avoid_freeing_console);
if (!avoid_freeing_console && amount <= 0 && !console_count && myself->ctty == -1)
{
- FreeConsole ();
- debug_printf ("freed console");
+ BOOL res = FreeConsole ();
+ debug_printf ("freed console, res %d", res);
+ init_console_handler (false);
}
return console_count;
}