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

Function getlock

outdated/sys/be/bemain.c:234–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234void
235getlock(void)
236{
237 int fd;
238
239 Sprintf(gl.lock, "%d%s", getuid(), svp.plname);
240 regularize(gl.lock);
241 set_levelfile_name(gl.lock, 0);
242 fd = creat(gl.lock, FCMASK);
243 if (fd == -1) {
244 error("cannot creat lock file.");
245 } else {
246 if (write(fd, (genericptr_t) &svh.hackpid, sizeof(svh.hackpid))
247 != sizeof(svh.hackpid)) {
248 error("cannot write lock");
249 }
250 if (close(fd) == -1) {
251 error("cannot close lock");
252 }
253 }
254}
255
256/* validate wizard mode if player has requested access to it */
257boolean

Callers 1

MAINFunction · 0.70

Calls 7

getuidFunction · 0.85
creatFunction · 0.85
writeFunction · 0.85
closeFunction · 0.85
regularizeFunction · 0.70
set_levelfile_nameFunction · 0.50
errorFunction · 0.50

Tested by

no test coverage detected