diff options
author | Christopher Faylor <me@cgf.cx> | 2009-07-17 18:17:11 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2009-07-17 18:17:11 +0000 |
commit | 486a2c9610f181a554686cc6f752865f40e5f08e (patch) | |
tree | 43988c6c242b7670b7ef63b2f86f0b7acf8e6d17 /winsup/cygwin/cygtls.cc | |
parent | d2445fa2cc4f8ce1021e75e1a690083ea6b0db7e (diff) | |
download | newlib-486a2c9610f181a554686cc6f752865f40e5f08e.zip newlib-486a2c9610f181a554686cc6f752865f40e5f08e.tar.gz newlib-486a2c9610f181a554686cc6f752865f40e5f08e.tar.bz2 |
* 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.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index f474d9b..b90b25f 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; |