diff options
author | Christopher Faylor <me@cgf.cx> | 2003-07-26 04:53:59 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-07-26 04:53:59 +0000 |
commit | df04ae29b258b89bbd4991bd862a03ac56430e4e (patch) | |
tree | f853669603e469c7c37bc4c829a247b16958464f /winsup/cygwin/exceptions.cc | |
parent | ddb67621550071ee1472cb114704af155d46365b (diff) | |
download | cygnal-df04ae29b258b89bbd4991bd862a03ac56430e4e.tar.gz cygnal-df04ae29b258b89bbd4991bd862a03ac56430e4e.tar.bz2 cygnal-df04ae29b258b89bbd4991bd862a03ac56430e4e.zip |
* exceptions.cc (ctrl_c_handler): Send SIGHUP when events occur only if there
is a tty associated with the process. Send SIGHUP on CTRL_LOGOFF_EVENT.
* fhandler_tty.cc (fhandler_tty_slave::open): Adjust console open handle
counter regardless of whether this is a pty or tty.
(fhandler_tty_slave::open): Ditto.
(fhandler_tty_slave::dup): Ditto.
(fhandler_tty_common::set_close_on_exec): Ditto.
(fhandler_tty_master::init_console): Decrement console open handle counter
after init since it will now be handled by all tty open.
* syscalls.cc (setsid): Rework debugging output slightly.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r-- | winsup/cygwin/exceptions.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 3c8bf39c9..e7c304185 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -923,25 +923,29 @@ setup_handler (int sig, void *handler, struct sigaction& siga) static BOOL WINAPI ctrl_c_handler (DWORD type) { - if (type == CTRL_LOGOFF_EVENT) - return TRUE; + static bool saw_close; /* Return FALSE to prevent an "End task" dialog box from appearing for each Cygwin process window that's open when the computer is shut down or console window is closed. */ + if (type == CTRL_SHUTDOWN_EVENT) { #if 0 /* Don't send a signal. Only NT service applications and their child - processes will receive this event and the services typically already + processes will receive this event and the services typically already handle the shutdown action when getting the SERVICE_CONTROL_SHUTDOWN control message. */ sig_send (NULL, SIGTERM); #endif return FALSE; } - if (type == CTRL_CLOSE_EVENT) + + if (myself->ctty != -1 + && (type == CTRL_CLOSE_EVENT || (!saw_close && type == CTRL_LOGOFF_EVENT))) { + if (type == CTRL_CLOSE_EVENT) + saw_close = true; sig_send (NULL, SIGHUP); return FALSE; } |