Fix: don't leak in_checkpoint on a failed level write.

save_currentstate() increments program_state.in_checkpoint and then
returns early without decrementing it when currentlevel_rewrite()
fails (full disk, quota, unwritable directory). The guard at the top
of the function suppresses every later checkpoint for the rest of the
game, leaving recover with nothing newer than the last checkpoint that
did get written, and nothing says so.
This commit is contained in:
k21971
2026-08-18 00:30:41 +00:00
parent 370c282240
commit 7c13477d33
+3 -1
View File
@@ -1385,8 +1385,10 @@ save_currentstate(void)
if (flags.ins_chkpt) {
/* write out just-attained level, with pets and everything */
nhfp = currentlevel_rewrite();
if (!nhfp)
if (!nhfp) {
program_state.in_checkpoint--;
return;
}
if (nhfp->structlevel)
bufon(nhfp->fd);
nhfp->mode = WRITING;