wizard bones bug (trunk only)

The wizard mode sequence
  load bones? y, unlink bones? y, die, save bones? y
works, but
  load bones? y, unlink bones? n, die, save bones? y, replace old bones? y
fails if/when external compression is in use.  The file gets uncompressed
before being opened to check its existence, then immediately closed, and
re-compressed, changing the file's name, before the deletion attempt takes
place.  Then delete_bonesfile() can't find it via the uncompressed name
and the bones saving code reports "cannot unlink old bones".

     The code involved doesn't seem to have changed since the current cvs
repository was set up, so this bug has gone unnoticed for a long time.
There's no reason this fix shouldn't go into the branch too, other than the
fact that I don't have that checked out on this machine.  If someone wants
to apply it there, be my guest (and move the fixes entry to fixes34.4).
This commit is contained in:
nethack.rankin
2012-01-28 02:52:14 +00:00
parent 1d219b4e1b
commit 7dd8600e17
2 changed files with 5 additions and 1 deletions

View File

@@ -402,6 +402,8 @@ hangup save made during magic mapping or <foo> detection performed while
underwater could put hero on top of the water after restore
items conferring life drain resistance were affected by drain life spell
'a'pply command could be used to recogniize undiscovered potions of oil
fix replacing an existing bones file in wizard mode [load?y, unlink?n, die?y,
save?y, replace?y] for configurations using external file compression
Platform- and/or Interface-Specific Fixes

View File

@@ -293,7 +293,6 @@ struct obj *corpse;
fd = open_bonesfile(&u.uz, &bonesid);
if (fd >= 0) {
(void) close(fd);
compress_bonesfile();
#ifdef WIZARD
if (wizard) {
if (yn("Bones file already exists. Replace it?") == 'y') {
@@ -302,6 +301,9 @@ struct obj *corpse;
}
}
#endif
/* compression can change the file's name, so must
wait until after any attempt to delete this file */
compress_bonesfile();
return;
}