From 6af92da76aade30eb64b809dd4e0ebce0650f4a7 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Fri, 16 Jan 2015 13:42:30 -0500 Subject: [PATCH] rogue5: ignore the file name stored in the save file. state.c had put file_name into the save file. The saved value was used to overwrite file_name on restore. If the save file had been renamed, unlink(file_name) would then fail, because file_name held the old name. To avoid breaking savefile compatibility, file_name is still saved, but it is read back into a temporary buffer and then ignored. I thought I fixed this already. --- rogue5/state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rogue5/state.c b/rogue5/state.c index 204ae72..ec9df88 100644 --- a/rogue5/state.c +++ b/rogue5/state.c @@ -1389,6 +1389,7 @@ rs_save_file(FILE *savef) int rs_restore_file(FILE *savef) { + char fake_file_name[MAXSTR]; THING *mitem; encclearerr(); @@ -1402,7 +1403,7 @@ rs_restore_file(FILE *savef) rs_read_int(savef, &terse); rs_read_int(savef, &tombstone); rs_read_ints(savef, pack_used, 26); - rs_read_chars(savef, file_name, MAXSTR); + rs_read_chars(savef, fake_file_name, MAXSTR); rs_read_chars(savef, huh, MAXSTR); rs_read_potions(savef); rs_read_rings(savef);