[PPL-devel] [GIT] ppl/ppl(master): No longer overwrite the SIGILL handler.

Roberto Bagnara bagnara at cs.unipr.it
Tue Feb 22 10:21:09 CET 2011


Module: ppl/ppl
Branch: master
Commit: 3c526a80d5c063d3f66c2fd2ed438d9d5fe91274
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=3c526a80d5c063d3f66c2fd2ed438d9d5fe91274

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Tue Feb 22 09:51:45 2011 +0100

No longer overwrite the SIGILL handler.

---

 src/fpu-ia32.cc |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/fpu-ia32.cc b/src/fpu-ia32.cc
index d361411..21aa6e3 100644
--- a/src/fpu-ia32.cc
+++ b/src/fpu-ia32.cc
@@ -37,7 +37,6 @@ jmp_buf env;
 
 void
 illegal_instruction_catcher(int) {
-  signal(SIGILL, SIG_DFL);
   longjmp(env, 1);
 }
 
@@ -49,6 +48,7 @@ bool have_sse_unit = true;
 
 void
 detect_sse_unit() {
+  void (*old)(int);
   if (setjmp(env)) {
     // We will end up here if sse_get_control() raises SIGILL.
     have_sse_unit = false;
@@ -56,14 +56,14 @@ detect_sse_unit() {
   }
 
   // Install our own signal handler for SIGILL.
-  signal(SIGILL, illegal_instruction_catcher);
+  old = signal(SIGILL, illegal_instruction_catcher);
   (void) sse_get_control();
   // sse_get_control() did not raise SIGILL: we have an SSE unit.
   have_sse_unit = true;
 
  restore_sigill_handler:
-  // Restore the default signal handler for SIGILL.
-  signal(SIGILL, SIG_DFL);
+  // Restore the previous signal handler for SIGILL.
+  signal(SIGILL, old);
 }
 
 } // namespace Parma_Polyhedra_Library




More information about the PPL-devel mailing list