* exceptions.cc (ctrl_c_handler): Only exit TRUE on CTRL_LOGOFF_EVENT when we

have actually handled the event.
This commit is contained in:
Christopher Faylor 2006-04-18 16:24:54 +00:00
parent d76895a142
commit 4c6f65fc7c
2 changed files with 17 additions and 20 deletions

View File

@ -1,3 +1,8 @@
2006-04-18 Christopher Faylor <cgf@timesys.com>
* exceptions.cc (ctrl_c_handler): Only exit TRUE on CTRL_LOGOFF_EVENT
when we have actually handled the event.
2006-04-17 Eric Blake <ebb9@byu.net> 2006-04-17 Eric Blake <ebb9@byu.net>
* mktemp.cc (_gettemp): Open temp files in binary mode. * mktemp.cc (_gettemp): Open temp files in binary mode.

View File

@ -929,27 +929,19 @@ ctrl_c_handler (DWORD type)
} }
if (!saw_close && type == CTRL_LOGOFF_EVENT) if (!saw_close && type == CTRL_LOGOFF_EVENT)
{ {
#if 0 /* The CTRL_LOGOFF_EVENT is sent when *any* user logs off.
/* CV, 2005-09-08: The CTRL_LOGOFF_EVENT is only send to services. The below code sends a SIGHUP only if it is not performing the
It's send when *any* user logs off. Services generally have default activity for SIGHUP. Note that it is possible for two
a modified console handler which allows services to survive SIGHUP signals to arrive if a process group leader is exiting
also after a user logged out, even if the service has a console too. Getting this 100% right is saved for a future cygwin mailing
window attached to the visible window station of the user list goad. */
("Interact with desktop"). The below code contradicts this if (global_sigs[SIGHUP].sa_handler != SIG_DFL)
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); sig_send (myself_nowait, SIGHUP);
#endif
return TRUE; return TRUE;
} }
return FALSE;
}
} }
/* If we are a stub and the new process has a pinfo structure, let it /* If we are a stub and the new process has a pinfo structure, let it