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
+1
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: real extended command menu so all extended commands can be entered
Gnome: ignore interrupts to avoid infinite loop in gnome library Gnome: ignore interrupts to avoid infinite loop in gnome library
tty: avoid crash displaying quit inventory if inventory was already displayed 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 General New Features
+8 -4
View File
@@ -1372,12 +1372,16 @@ int retryct;
#define OPENFAILURE(fd) (fd < 0) #define OPENFAILURE(fd) (fd < 0)
lockptr = -1; lockptr = -1;
# endif # endif
while (retryct-- && OPENFAILURE(lockptr)) { while (--retryct && OPENFAILURE(lockptr)) {
# ifdef AMIGA # if defined(WIN32) && !defined(WIN_CE)
(void)DeleteFile(lockname); /* in case dead process was here first */ lockptr = sopen(lockname, O_RDWR|O_CREAT, SH_DENYRW, S_IWRITE);
lockptr = Open(lockname,MODE_NEWFILE);
# else # 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); lockptr = open(lockname, O_RDWR|O_CREAT|O_EXCL, S_IWRITE);
# endif
# endif # endif
if (OPENFAILURE(lockptr)) { if (OPENFAILURE(lockptr)) {
raw_printf("Waiting for access to %s. (%d retries left).", raw_printf("Waiting for access to %s. (%d retries left).",