summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/cygtls.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2009-07-17 18:17:11 +0000
committerChristopher Faylor <me@cgf.cx>2009-07-17 18:17:11 +0000
commit486a2c9610f181a554686cc6f752865f40e5f08e (patch)
tree43988c6c242b7670b7ef63b2f86f0b7acf8e6d17 /winsup/cygwin/cygtls.cc
parentd2445fa2cc4f8ce1021e75e1a690083ea6b0db7e (diff)
downloadcygnal-486a2c9610f181a554686cc6f752865f40e5f08e.tar.gz
cygnal-486a2c9610f181a554686cc6f752865f40e5f08e.tar.bz2
cygnal-486a2c9610f181a554686cc6f752865f40e5f08e.zip
* cygtls.cc (_cygtls::init_exception_handler): Test for e, not e->prev or we
could still end up adding our handler twice. Add comment explaining what we're doing. * dll_init.cc (dll_dllcrt0_1): Clarify comment.
Diffstat (limited to 'winsup/cygwin/cygtls.cc')
-rw-r--r--winsup/cygwin/cygtls.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc
index f474d9b35..b90b25fa2 100644
--- a/winsup/cygwin/cygtls.cc
+++ b/winsup/cygwin/cygtls.cc
@@ -228,7 +228,23 @@ extern exception_list *_except_list asm ("%fs:0");
void
_cygtls::init_exception_handler (exception_handler *eh)
{
- for (exception_list *e = _except_list; e->prev != NULL && e->prev != (exception_list *)-1; e = e->prev)
+ /* Here in the distant past of 17-Jul-2009, we had an issue where Windows
+ 2008 became YA perplexed because the cygwin exception handler was added
+ at the start of the SEH while still being in the list further on. This
+ was because we added a loop by setting el.prev to _except_list here.
+ Since el is reused in this thread, and this function can be called
+ more than once when a dll is loaded, this is not a good thing.
+
+ So, for now, until the next required tweak, we will just avoid adding the
+ cygwin exception handler if it is already on this list. This could present
+ a problem if some previous exception handler tries to do things that are
+ better left to Cygwin. I await the cygwin mailing list notification of
+ this event with bated breath.
+
+ (cgf 2009-07-17) */
+ for (exception_list *e = _except_list;
+ e != NULL && e != (exception_list *) -1;
+ e = e->prev)
if (e == &el)
return;
el.handler = eh;