summaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-09-24 21:05:08 +0000
committerache <ache@FreeBSD.org>1997-09-24 21:05:08 +0000
commitd7d1a88a74734936b18b446d25dccda2beff8248 (patch)
treec7fbbbe55ee72db3442875f5e2c9d6f046b5fe7b /games
parent4b745741b34f3f473d680694765a66cf3a73aa8a (diff)
downloadFreeBSD-src-d7d1a88a74734936b18b446d25dccda2beff8248.zip
FreeBSD-src-d7d1a88a74734936b18b446d25dccda2beff8248.tar.gz
Fix longstanding bug: it was impossible to save to the same file twice
since it was deleted on exit.
Diffstat (limited to 'games')
-rw-r--r--games/rogue/save.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/games/rogue/save.c b/games/rogue/save.c
index 8d0881a..46d7ef5 100644
--- a/games/rogue/save.c
+++ b/games/rogue/save.c
@@ -55,6 +55,7 @@ static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
short write_failed = 0;
char *save_file = (char *) 0;
+static char save_name[80];
extern boolean detect_monster;
extern short cur_level, max_level;
@@ -159,14 +160,16 @@ char *sfile;
if (write_failed) {
(void) md_df(sfile); /* delete file */
} else {
+ if (strcmp(sfile, save_name) == 0)
+ save_name[0] = 0;
clean_up("");
}
}
-static char save_name[80];
-
static del_save_file()
{
+ if (!save_name[0])
+ return;
/* revoke */
setgid(getgid());
md_df(save_name);
OpenPOWER on IntegriCloud