changeset 7:d388234c4ce9

Don't autosave on segfault or after death
author edwarj4
date Fri, 16 Oct 2009 14:40:16 +0000
parents 9a2c0c60c386
children 78df7025783b
files rogue3/mdport.c rogue3/rip.c
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rogue3/mdport.c	Fri Oct 16 14:30:06 2009 +0000
+++ b/rogue3/mdport.c	Fri Oct 16 14:40:16 2009 +0000
@@ -252,7 +252,9 @@
     signal(SIGBUS, auto_save);
 #endif
 #ifdef SIGSEGV
-    signal(SIGSEGV, auto_save);
+    /* If there's a segfault, the game state is probably trashed
+       and there's no point saving it. */
+    signal(SIGSEGV, SIG_DFL);
 #endif
 #ifdef SIGSYS
     signal(SIGSYS, auto_save);
--- a/rogue3/rip.c	Fri Oct 16 14:30:06 2009 +0000
+++ b/rogue3/rip.c	Fri Oct 16 14:40:16 2009 +0000
@@ -55,6 +55,11 @@
     time_t date;
     char buf[80];
 
+    /* Don't autosave dead games.  It would be a good idea to autosave a 
+       game that is between death and scoreboard write, but the restore 
+       code can't handle that case yet. */
+    md_onsignal_default();
+
     time(&date);
     lt = localtime(&date);
     clear();