From 3b1a8c572f8cea988ac1ede84000401f6d8c402e Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 21 Jan 2013 16:56:09 +0000 Subject: [PATCH] * dcrt0.cc (dll_crt0_1): Flag that we are working "incyg". Handle any signals (presumably exiting signals) which may have come in while we are in the process of setting up. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/dcrt0.cc | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 93a8062a7..57969024f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2013-01-21 Christopher Faylor + + * dcrt0.cc (dll_crt0_1): Flag that we are working "incyg". Handle any + signals (presumably exiting signals) which may have come in while we + are in the process of setting up. + 2013-01-21 Christopher Faylor * update-copyright: Recognize configure.ac scripts too. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index cbe1b282f..931ebd9e8 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -820,6 +820,8 @@ dll_crt0_1 (void *) { extern void initial_setlocale (); + _my_tls.incyg++; + if (dynamically_loaded) sigproc_init (); @@ -987,7 +989,13 @@ dll_crt0_1 (void *) /* Per POSIX set the default application locale back to "C". */ _setlocale_r (_REENT, LC_CTYPE, "C"); - if (user_data->main) + if (!user_data->main) + { + /* Handle any signals which may have arrived */ + _my_tls.call_signal_handler (); + _my_tls.incyg--; /* Not in Cygwin anymore */ + } + else { /* Create a copy of Cygwin's version of __argv so that, if the user makes a change to an element of argv[] it does not affect Cygwin's argv. @@ -998,6 +1006,9 @@ dll_crt0_1 (void *) char **oav = __argv; while ((*nav++ = *oav++) != NULL) continue; + /* Handle any signals which may have arrived */ + _my_tls.call_signal_handler (); + _my_tls.incyg--; /* Not in Cygwin anymore */ cygwin_exit (user_data->main (__argc, newargv, *user_data->envptr)); } __asm__ (" \n\