]> granicus.if.org Git - nethack/commitdiff
trickery bulletproofing
authornethack.rankin <nethack.rankin>
Thu, 22 Aug 2002 03:05:18 +0000 (03:05 +0000)
committernethack.rankin <nethack.rankin>
Thu, 22 Aug 2002 03:05:18 +0000 (03:05 +0000)
     Prevent the pardoning of trickery in wizard mode from attempting
to continue when there's no longer any current level.  Also prevent
the ZEROCOMP configuration from trying to read from file descriptor -1
in case there're any other places which still let that slip through.
And fix an oddity in the VMS port's error() routine which has gone
unnoticed for years.

doc/fixes34.1
src/do.c
src/restore.c
sys/vms/vmstty.c

index 84a24430f9b233ad911ff53d3aec848715d1ef19..7d855f8619e27a697899f1c09aa0e973e7eae5b2 100644 (file)
@@ -220,6 +220,8 @@ If there were a hole outside a shop, you could kick stuff out of the door
 curing hallucination while wielding Grayswandir should print a message
 removing unowned pick-axe from container in shop gave inappropriate message
 don't let monster end up with more current HP than max HP after life drain
+make sure that missing file trickery in wizard mode which is discovered during
+       level change doesn't try to keep going after discarding current level
 
 
 Platform- and/or Interface-Specific Fixes
@@ -262,6 +264,7 @@ Gnome/Linux: more portable getres*id workaround
 msdos: compiling without NO_TERMS resulted in a link-time error
 msdos: reworked Makefile.GCC to get rid of need to duplicate source files
 msdos,win32: stop doing chdir when NOCWD_ASSUMPTIONS is defined
+vms: prevent error() from indirectly triggering hangup save during forced exit
 
 
 General New Features
index 9d5f067c1263889bd61e84bfaf9d631e6baf4bec..e320e28a80fae97eaeb42257e1687273d8a98a7e 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1055,6 +1055,8 @@ boolean at_stairs, falling, portal;
                                        (int) new_ledger, depth(&u.uz), errno);
                        pline("Probably someone removed it.");
                        done(TRICKED);
+                       /* we'll reach here if running in wizard mode */
+                       error("Cannot continue this game.");
                }
                minit();        /* ZEROCOMP */
                getlev(fd, hackpid, new_ledger, FALSE);
index 899b5a69d2c16ca2693a127593ae4a5650564a1f..3874c5f2ac80514de00d856f1c328aa3adad88fd 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)restore.c  3.4     1999/11/20      */
+/*     SCCS Id: @(#)restore.c  3.4     2002/08/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1026,6 +1026,7 @@ genericptr_t buf;
 register unsigned len;
 {
     /*register int readlen = 0;*/
+    if (fd < 0) error("Restore error; mread attempting to read file %d.", fd);
     mreadfd = fd;
     while (len--) {
        if (inrunlength > 0) {
index e9add7639b091b4f1aff82cc650f75fbd563a2a1..894c1eff8cc8fe67f9373f79a566547fe23e6ead 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)vmstty.c   3.4     1995/07/09      */
+/*     SCCS Id: @(#)vmstty.c   3.4     2002/08/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 /* tty.c - (VMS) version */
@@ -477,5 +477,9 @@ error VA_DECL(const char *,s)
        Vprintf(s,VA_ARGS);
        (void) putchar('\n');
        VA_END();
+#ifndef SAVE_ON_FATAL_ERROR
+       /* prevent vmsmain's exit handler byebye() from calling hangup() */
+       (void)signal(SIGHUP, SIG_DFL);
+#endif
        exit(EXIT_FAILURE);
 }