lock -> g.lock

This commit is contained in:
Bart House
2018-12-25 13:05:43 -08:00
parent c67f7e5122
commit 64be5fd35a
7 changed files with 54 additions and 54 deletions

View File

@@ -24,16 +24,16 @@ getlock(void)
int fd;
int pid = getpid(); /* Process ID */
Sprintf(lock, "%d%s", getuid(), g.plname);
set_levelfile_name(lock, 0);
Sprintf(g.lock, "%d%s", getuid(), g.plname);
set_levelfile_name(g.lock, 0);
if ((fd = open(lock, O_RDWR | O_EXCL | O_CREAT, LEVL_TYPE)) == -1) {
raw_printf("Could not lock the game %s.", lock);
if ((fd = open(g.lock, O_RDWR | O_EXCL | O_CREAT, LEVL_TYPE)) == -1) {
raw_printf("Could not lock the game %s.", g.lock);
panic("Another game in progress?");
}
if (write(fd, (char *) &pid, sizeof(pid)) != sizeof(pid)) {
raw_printf("Could not lock the game %s.", lock);
raw_printf("Could not lock the game %s.", g.lock);
panic("Disk locked?");
}
close(fd);