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

since it was deleted on exit.
This commit is contained in:
Andrey A. Chernov 1997-09-24 21:05:08 +00:00
parent 1a7c2c21c1
commit 56eb7842b4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29821

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