MCPcopy Create free account
hub / github.com/NetHack/NetHack / eraseoldlocks

Function eraseoldlocks

sys/unix/unixunix.c:79–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79static int
80eraseoldlocks(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
102void
103getlock(void)

Callers 1

getlockFunction · 0.70

Calls 3

unlinkFunction · 0.85
fqnameFunction · 0.85
set_levelfile_nameFunction · 0.50

Tested by

no test coverage detected