diff options
author | Christopher Faylor <me@cgf.cx> | 2006-04-18 16:24:54 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-04-18 16:24:54 +0000 |
commit | 4c6f65fc7cb35214eb75198d5a131b0927158688 (patch) | |
tree | 52c489c6066114e479efc67ac0342881d65a0f57 /winsup/cygwin/exceptions.cc | |
parent | d76895a142ef4d9f9ccacf2c98a2bf135bdd857b (diff) | |
download | newlib-4c6f65fc7cb35214eb75198d5a131b0927158688.zip newlib-4c6f65fc7cb35214eb75198d5a131b0927158688.tar.gz newlib-4c6f65fc7cb35214eb75198d5a131b0927158688.tar.bz2 |
* exceptions.cc (ctrl_c_handler): Only exit TRUE on CTRL_LOGOFF_EVENT when we
have actually handled the event.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r-- | winsup/cygwin/exceptions.cc | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 11058de..b18d82a 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -929,26 +929,18 @@ ctrl_c_handler (DWORD type) } if (!saw_close && type == CTRL_LOGOFF_EVENT) { -#if 0 - /* CV, 2005-09-08: The CTRL_LOGOFF_EVENT is only send to services. - It's send when *any* user logs off. Services generally have - a modified console handler which allows services to survive - also after a user logged out, even if the service has a console - window attached to the visible window station of the user - ("Interact with desktop"). The below code contradicts this - standard behaviour, so for now, we disable it and just return - FALSE to get the default behaviour or the one the application's - own console handler (if any) requires. - In other words: We never send SIGHUP to services and their - child processes on a LOGOFF event. */ - - /* Check if the process is actually associated with a visible - window station, one which actually represents a visible desktop. - If not, the CTRL_LOGOFF_EVENT doesn't concern this process. */ - if (has_visible_window_station ()) - sig_send (myself_nowait, SIGHUP); -#endif - return TRUE; + /* The CTRL_LOGOFF_EVENT is sent when *any* user logs off. + The below code sends a SIGHUP only if it is not performing the + default activity for SIGHUP. Note that it is possible for two + SIGHUP signals to arrive if a process group leader is exiting + too. Getting this 100% right is saved for a future cygwin mailing + list goad. */ + if (global_sigs[SIGHUP].sa_handler != SIG_DFL) + { + sig_send (myself_nowait, SIGHUP); + return TRUE; + } + return FALSE; } } |