| 988 | |
| 989 | #ifdef PC_LOCKING |
| 990 | static int |
| 991 | eraseoldlocks(void) |
| 992 | { |
| 993 | int i; |
| 994 | |
| 995 | /* cannot use maxledgerno() here, because we need to find a lock name |
| 996 | * before starting everything (including the dungeon initialization |
| 997 | * that sets astral_level, needed for maxledgerno()) up |
| 998 | */ |
| 999 | for (i = 1; i <= MAXDUNGEON * MAXLEVEL + 1; i++) { |
| 1000 | /* try to remove all */ |
| 1001 | set_levelfile_name(gl.lock, i); |
| 1002 | (void) unlink(fqname(gl.lock, LEVELPREFIX, 0)); |
| 1003 | } |
| 1004 | set_levelfile_name(gl.lock, 0); |
| 1005 | #ifdef HOLD_LOCKFILE_OPEN |
| 1006 | really_close(); |
| 1007 | #endif |
| 1008 | if (unlink(fqname(gl.lock, LEVELPREFIX, 0))) |
| 1009 | return 0; /* cannot remove it */ |
| 1010 | return (1); /* success! */ |
| 1011 | } |
| 1012 | |
| 1013 | DISABLE_WARNING_UNREACHABLE_CODE |
| 1014 |
no test coverage detected