From 5b3e1f7358338fa4fe7223fb34df9a06fda7e97c Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 30 Jun 2005 02:52:14 +0000 Subject: * cygerrno.h: Make multi-inclusion safe. * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Deal with EINTR. * dcrt0.cc (dll_crt0_0): Accommodate init_console_handler argument change. * winsup.h: Ditto. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * exceptions.cc (init_console_handler): Ditto. Ignore console events if we're not attached to a terminal. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * wincap.cc: Implement has_null_console_handler_routine throughout. * wincap.h: Ditto. --- winsup/cygwin/exceptions.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/exceptions.cc') diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 6e44b5b21..0e7a09fdf 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -114,11 +114,24 @@ init_exceptions (exception_list *el) init_exception_handler (el, handle_exceptions); } +BOOL WINAPI +dummy_ctrl_c_handler (DWORD dwCtrlType) +{ + return TRUE; +} + void -init_console_handler () +init_console_handler (BOOL install_handler) { + BOOL res; (void) SetConsoleCtrlHandler (ctrl_c_handler, FALSE); - if (!SetConsoleCtrlHandler (ctrl_c_handler, TRUE)) + if (install_handler) + res = SetConsoleCtrlHandler (ctrl_c_handler, TRUE); + else if (wincap.has_null_console_handler_routine ()) + res = SetConsoleCtrlHandler (NULL, TRUE); + else + res = SetConsoleCtrlHandler (dummy_ctrl_c_handler, TRUE); + if (!res) system_printf ("SetConsoleCtrlHandler failed, %E"); } -- cgit v1.2.3