summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/exceptions.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-10-14 09:21:55 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-10-14 09:21:55 +0000
commitdb3137ccb5d3c7499a665d17abf84cf523146cbf (patch)
treeb1b538b50fca9ff69e4706d3cd975a302fce0453 /winsup/cygwin/exceptions.cc
parent2286046e474399b7d5a8ddd7b30ba96dd915a4e8 (diff)
downloadcygnal-db3137ccb5d3c7499a665d17abf84cf523146cbf.tar.gz
cygnal-db3137ccb5d3c7499a665d17abf84cf523146cbf.tar.bz2
cygnal-db3137ccb5d3c7499a665d17abf84cf523146cbf.zip
* exceptions.cc (ctrl_c_handler): Don't send SIGHUP on
CTRL_LOGOFF_EVENT to processes running in invisible Windows Stations. * window.cc (has_visible_window_station): New function. * winsup.h: Add declaration for has_visible_window_station.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r--winsup/cygwin/exceptions.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 24b452be7..65d57b361 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -12,6 +12,8 @@ details. */
#include <imagehlp.h>
#include <stdlib.h>
#include <setjmp.h>
+#include <wingdi.h>
+#include <winuser.h>
#include "exceptions.h"
#include "sync.h"
@@ -919,13 +921,23 @@ ctrl_c_handler (DWORD type)
return FALSE;
}
- if (myself->ctty != -1
- && (type == CTRL_CLOSE_EVENT || (!saw_close && type == CTRL_LOGOFF_EVENT)))
+ if (myself->ctty != -1)
{
if (type == CTRL_CLOSE_EVENT)
- saw_close = true;
- sig_send (NULL, SIGHUP);
- return FALSE;
+ {
+ saw_close = true;
+ sig_send (NULL, SIGHUP);
+ return FALSE;
+ }
+ if (!saw_close && type == CTRL_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 (NULL, SIGHUP);
+ return FALSE;
+ }
}
/* If we are a stub and the new process has a pinfo structure, let it