From: Ben Pfaff Date: Sat, 2 Oct 2010 17:21:21 +0000 (-0700) Subject: pspp: Make a signal that indicates a bug re-raise that signal to exit. X-Git-Tag: v0.7.6~126 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38f3d1b22ea23d0afb8f0aa32641763f76b4ba93;p=pspp-builds.git pspp: Make a signal that indicates a bug re-raise that signal to exit. John Darrington pointed out that exiting with EXIT_FAILURE isn't nearly emphatic enough here. --- diff --git a/src/libpspp/message.c b/src/libpspp/message.c index 0ca2749d..ed6d6e7a 100644 --- a/src/libpspp/message.c +++ b/src/libpspp/message.c @@ -312,7 +312,7 @@ msg_enable (void) /* Private functions. */ void -request_bug_report_and_abort (const char *msg) +request_bug_report (const char *msg) { fprintf (stderr, "******************************************************\n"); fprintf (stderr, "You have discovered a bug in PSPP. Please report this\n"); @@ -334,7 +334,5 @@ request_bug_report_and_abort (const char *msg) #endif ); fprintf (stderr, "******************************************************\n"); - - _exit (EXIT_FAILURE); } diff --git a/src/libpspp/message.h b/src/libpspp/message.h index 7c111017..fad7816f 100644 --- a/src/libpspp/message.h +++ b/src/libpspp/message.h @@ -117,7 +117,7 @@ void msg_ui_disable_warnings (bool); /* Used in panic situations only. */ -void request_bug_report_and_abort (const char *msg) NO_RETURN; +void request_bug_report (const char *msg); #endif /* message.h */ diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index 94b21a55..7d2c97f9 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -155,20 +155,27 @@ fpu_init (void) void bug_handler(int sig) { + /* Reset SIG to its default handling so that if it happens again we won't + recurse. */ + signal (sig, SIG_DFL); + #if DEBUGGING connect_debugger (); #endif switch (sig) { case SIGABRT: - request_bug_report_and_abort("Assertion Failure/Abort"); + request_bug_report("Assertion Failure/Abort"); case SIGFPE: - request_bug_report_and_abort("Floating Point Exception"); + request_bug_report("Floating Point Exception"); case SIGSEGV: - request_bug_report_and_abort("Segmentation Violation"); + request_bug_report("Segmentation Violation"); default: - request_bug_report_and_abort("Unknown"); + request_bug_report("Unknown"); } + + /* Re-raise the signal so that we terminate with the correct status. */ + raise (sig); } /* Clean up PSPP in preparation for termination. */