| 77 | } |
| 78 | |
| 79 | static int |
| 80 | eraseoldlocks(void) |
| 81 | { |
| 82 | int i; |
| 83 | |
| 84 | #if defined(HANGUPHANDLING) |
| 85 | program_state.preserve_locks = 0; /* not required but shows intent */ |
| 86 | /* cannot use maxledgerno() here, because we need to find a lock name |
| 87 | * before starting everything (including the dungeon initialization |
| 88 | * that sets astral_level, needed for maxledgerno()) up |
| 89 | */ |
| 90 | #endif |
| 91 | for (i = 1; i <= MAXDUNGEON * MAXLEVEL + 1; i++) { |
| 92 | /* try to remove all */ |
| 93 | set_levelfile_name(gl.lock, i); |
| 94 | (void) unlink(fqname(gl.lock, LEVELPREFIX, 0)); |
| 95 | } |
| 96 | set_levelfile_name(gl.lock, 0); |
| 97 | if (unlink(fqname(gl.lock, LEVELPREFIX, 0))) |
| 98 | return 0; /* cannot remove it */ |
| 99 | return 1; /* success! */ |
| 100 | } |
| 101 | |
| 102 | void |
| 103 | getlock(void) |
no test coverage detected