From 7c13477d33be7ac075e445e8a99522ef6affb7fa Mon Sep 17 00:00:00 2001 From: k21971 Date: Tue, 18 Aug 2026 00:30:41 +0000 Subject: [PATCH] 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. --- src/do.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/do.c b/src/do.c index 5de166814..bd1e18286 100644 --- a/src/do.c +++ b/src/do.c @@ -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;