summaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
Diffstat (limited to 'games')
-rw-r--r--games/rogue/save.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/games/rogue/save.c b/games/rogue/save.c
index 76475bb..2ca5cc3 100644
--- a/games/rogue/save.c
+++ b/games/rogue/save.c
@@ -108,6 +108,7 @@ char *sfile;
sfile = name_buffer;
}
}
+ setuid(getuid());
if ( ((fp = fopen(sfile, "w")) == NULL) ||
((file_id = md_get_file_id(sfile)) == -1)) {
message("problem accessing the save file", 0);
@@ -161,6 +162,14 @@ char *sfile;
}
}
+static char save_name[80];
+
+static del_save_file()
+{
+ setuid(getuid());
+ md_df(save_name);
+}
+
restore(fname)
char *fname;
{
@@ -233,8 +242,9 @@ char *fname;
clear();
clean_up("sorry, file has been touched");
}
- if ((!wizard) && !md_df(fname)) {
- clean_up("cannot delete file");
+ if ((!wizard)) {
+ strcpy(save_name, fname);
+ atexit(del_save_file);
}
msg_cleared = 0;
ring_stats(0);
OpenPOWER on IntegriCloud