Changes to be committed:
	modified:   include/extern.h
	modified:   src/bones.c
	modified:   src/do.c
	modified:   src/files.c
	modified:   src/music.c
	modified:   src/restore.c
	modified:   src/save.c
	modified:   sys/share/pcmain.c
	modified:   sys/share/pcsys.c
	modified:   sys/share/pcunix.c

In order to get level file locking correctly again post 3.4.3
with the newer compilers for windows, I had to funnel close()
calls to an intercepting routine.

I had two choices:

1. Surround every close() in at least 9 source files with messy:
	#ifdef WIN32
		nhclose(fd);
	#else
		close(fd);
	#endif

OR

2. Replace every close() with nhclose() and
   deal with the special code in the nhclose()
   version for windows, while just calling
   close() for other platforms (in files.c).

   It is also possible, although not done in this commit,
   to
	#define nhclose(fd) close(fd)
   in a header file for non-windows, rather than funnel
   though a real nhclose() function in files.c.
This commit is contained in:
nhmall
2015-04-06 10:12:10 -04:00
parent b7ad4a8a2a
commit 3d6fabf730
10 changed files with 68 additions and 60 deletions
+2 -2
View File
@@ -945,7 +945,7 @@ currentlevel_rewrite()
#ifdef MFLOPPY
if (!savelev(fd, ledger_no(&u.uz), COUNT_SAVE)) {
(void) close(fd);
(void) nhclose(fd);
delete_levelfile(ledger_no(&u.uz));
pline("NetHack is out of disk space for making levels!");
You("can save, quit, or continue playing.");
@@ -1160,7 +1160,7 @@ boolean at_stairs, falling, portal;
}
minit(); /* ZEROCOMP */
getlev(fd, hackpid, new_ledger, FALSE);
(void) close(fd);
(void) nhclose(fd);
oinit(); /* reassign level dependent obj probabilities */
}
/* do this prior to level-change pline messages */