changeset 2536:1d63e820ee13

[project @ 1996-11-19 20:34:29 by jwe]
author jwe
date Tue, 19 Nov 1996 20:34:30 +0000
parents caa21ce81913
children 80b982e7f4b1
files src/ChangeLog src/sighandlers.cc
diffstat 2 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Nov 19 19:53:57 1996 +0000
+++ b/src/ChangeLog	Tue Nov 19 20:34:30 1996 +0000
@@ -1,5 +1,8 @@
 Tue Nov 19 12:01:13 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* sighandlers.cc (my_friendly_exit): If we are called twice, try
+	to remove the signal handler for SIGABRT and the call abort ().
+
 	* help.cc (Ftype): If a function is defined from a file and
 	transformed text has not been requested, just print the contents
 	of the file.
--- a/src/sighandlers.cc	Tue Nov 19 19:53:57 1996 +0000
+++ b/src/sighandlers.cc	Tue Nov 19 20:34:30 1996 +0000
@@ -24,7 +24,9 @@
 #include <config.h>
 #endif
 
+#include <cstdlib>
 #include <csignal>
+
 #include <new>
 
 #include <iostream.h>
@@ -88,11 +90,28 @@
 static void
 my_friendly_exit (const char *sig_name, int sig_number)
 {
-  error ("%s -- stopping myself...", sig_name);
+  static bool been_there_done_that = false;
+
+  if (been_there_done_that)
+    {
+#ifdef SIGABRT
+      octave_set_signal_handler (SIGABRT, SIG_DFL);
+#endif
+
+      error ("attempted clean up seems to have failed -- aborting...");
 
-  save_user_variables ();
+      abort ();
+    }
+  else
+    {
+      been_there_done_that = true;
 
-  clean_up_and_exit (sig_number);
+      error ("%s -- stopping myself...", sig_name);
+
+      save_user_variables ();
+
+      clean_up_and_exit (sig_number);
+    }
 }
 
 // I know, not really a signal handler.