handheld lockfile left around fix (from <Someone>)

This commit is contained in:
nethack.allison
2003-10-25 18:32:30 +00:00
parent 2a9f2b1f36
commit 125d1f1cf1
2 changed files with 9 additions and 4 deletions

View File

@@ -102,6 +102,7 @@ Gnome: key values on unsigned char platform could fail to compare correctly
Gnome: real extended command menu so all extended commands can be entered
Gnome: ignore interrupts to avoid infinite loop in gnome library
tty: avoid crash displaying quit inventory if inventory was already displayed
winCE: ensure orphaned lockfile is always deleted on single-user handhelds
General New Features

View File

@@ -1372,12 +1372,16 @@ int retryct;
#define OPENFAILURE(fd) (fd < 0)
lockptr = -1;
# endif
while (retryct-- && OPENFAILURE(lockptr)) {
# ifdef AMIGA
(void)DeleteFile(lockname); /* in case dead process was here first */
lockptr = Open(lockname,MODE_NEWFILE);
while (--retryct && OPENFAILURE(lockptr)) {
# if defined(WIN32) && !defined(WIN_CE)
lockptr = sopen(lockname, O_RDWR|O_CREAT, SH_DENYRW, S_IWRITE);
# else
(void)DeleteFile(lockname); /* in case dead process was here first */
# ifdef AMIGA
lockptr = Open(lockname,MODE_NEWFILE);
# else
lockptr = open(lockname, O_RDWR|O_CREAT|O_EXCL, S_IWRITE);
# endif
# endif
if (OPENFAILURE(lockptr)) {
raw_printf("Waiting for access to %s. (%d retries left).",