[PATCH 1/3] [Msvcrt]: reset a signal to DFL after it's been used

Eric Pouech eric.pouech at wanadoo.fr
Tue Jan 2 07:30:59 CST 2007




A+
---

 dlls/msvcrt/except.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c
index 07cc61a..8625cea 100644
--- a/dlls/msvcrt/except.c
+++ b/dlls/msvcrt/except.c
@@ -429,6 +429,7 @@ struct
 static LONG WINAPI msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except)
 {
     LONG ret = EXCEPTION_CONTINUE_SEARCH;
+    MSVCRT___sighandler_t handler;
 
     if (!except || !except->ExceptionRecord)
         return EXCEPTION_CONTINUE_SEARCH;
@@ -436,10 +437,10 @@ static LONG WINAPI msvcrt_exception_filt
     switch (except->ExceptionRecord->ExceptionCode)
     {
     case EXCEPTION_ACCESS_VIOLATION:
-        if (sighandlers[MSVCRT_SIGSEGV])
+        if ((handler = sighandlers[MSVCRT_SIGSEGV]) != MSVCRT_SIG_DFL)
         {
-            if (sighandlers[MSVCRT_SIGSEGV] != MSVCRT_SIG_IGN)
-                sighandlers[MSVCRT_SIGSEGV](MSVCRT_SIGSEGV);
+            sighandlers[MSVCRT_SIGSEGV] = MSVCRT_SIG_DFL;
+            if (handler != MSVCRT_SIG_IGN) handler(MSVCRT_SIGSEGV);
             ret = EXCEPTION_CONTINUE_EXECUTION;
         }
         break;
@@ -455,13 +456,13 @@ static LONG WINAPI msvcrt_exception_filt
     case EXCEPTION_FLT_OVERFLOW:
     case EXCEPTION_FLT_STACK_CHECK:
     case EXCEPTION_FLT_UNDERFLOW:
-        if (sighandlers[MSVCRT_SIGFPE])
+        if ((handler = sighandlers[MSVCRT_SIGFPE]) != MSVCRT_SIG_DFL)
         {
-            if (sighandlers[MSVCRT_SIGFPE] != MSVCRT_SIG_IGN)
+            sighandlers[MSVCRT_SIGSEGV] = MSVCRT_SIG_DFL;
+            if (handler != MSVCRT_SIG_IGN)
             {
                 int i, float_signal = _FPE_INVALID;
 
-                float_handler handler = (float_handler)sighandlers[MSVCRT_SIGFPE];
                 for (i = 0; i < sizeof(float_exception_map) /
                  sizeof(float_exception_map[0]); i++)
                     if (float_exception_map[i].status ==
@@ -470,16 +471,17 @@ static LONG WINAPI msvcrt_exception_filt
                         float_signal = float_exception_map[i].signal;
                         break;
                     }
-                handler(MSVCRT_SIGFPE, float_signal);
+                ((float_handler)handler)(MSVCRT_SIGFPE, float_signal);
             }
             ret = EXCEPTION_CONTINUE_EXECUTION;
         }
         break;
     case EXCEPTION_ILLEGAL_INSTRUCTION:
-        if (sighandlers[MSVCRT_SIGILL])
+        if ((handler = sighandlers[MSVCRT_SIGILL]) != MSVCRT_SIG_DFL)
         {
-            if (sighandlers[MSVCRT_SIGILL] != MSVCRT_SIG_IGN)
-                sighandlers[MSVCRT_SIGILL](MSVCRT_SIGILL);
+            sighandlers[MSVCRT_SIGSEGV] = MSVCRT_SIG_DFL;
+            if (handler != MSVCRT_SIG_IGN)
+                handler(MSVCRT_SIGILL);
             ret = EXCEPTION_CONTINUE_EXECUTION;
         }
         break;




More information about the wine-patches mailing list