Fix longstanding bug: it was impossible to save to the same file twice

since it was deleted on exit.
This commit is contained in:
ache 1997-09-24 21:05:08 +00:00
parent e41e566a48
commit 0579566b01

View File

@ -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);