Mercurial > hg > early-roguelike
diff rogue3/save.c @ 2:e676d52b5d09
Prevent changing name or save file when using system savedir
author | edwarj4 |
---|---|
date | Wed, 14 Oct 2009 11:21:33 +0000 |
parents | b4856d4d4c4e |
children | 09da55b986ca |
line wrap: on
line diff
--- a/rogue3/save.c Wed Oct 14 01:32:13 2009 +0000 +++ b/rogue3/save.c Wed Oct 14 11:21:33 2009 +0000 @@ -51,6 +51,10 @@ msg("File name: %s", file_name); goto gotfile; } + if (use_savedir) + return FALSE; + /* because you're not allowed to change the savefile if + you're using the system savedir! */ } do @@ -66,11 +70,15 @@ strcpy(file_name, buf); gotfile: if ((savef = fopen(file_name, "w")) == NULL) + { msg(strerror(errno)); /* fake perror() */ + if (use_savedir) + return FALSE; + } } while (savef == NULL); /* - * write out encrpyted file (after a stat) + * write out encrypted file (after a stat) * The fwrite is to force allocation of the buffer before the write */ if (save_file(savef) != 0)