Implement fcntl(2) file locking

If you run a server, then you know of the somewhat annoying perm_lock
errors that creep up, requiring your attention before anyone else can
start a game.

This patch properly implements fcntl(2) locking on systems that can
handle it (*nix systems), that results in the lock being automatically
released on program termination, whether abnormal or not.

Original patch by Drew Streib, update by Edoardo Spadolini
This commit is contained in:
Pasi Kallinen
2015-03-07 15:11:41 +02:00
parent 7fa05c6311
commit 66a1f0ced4
2 changed files with 62 additions and 4 deletions

View File

@@ -217,6 +217,12 @@
#define FCMASK 0660 /* file creation mask */
/* fcntl(2) is a POSIX-portable call for manipulating file descriptors.
* Comment out the USE_FCNTL if for some reason you have a strange
* OS/filesystem combination for which fcntl(2) does not work. */
#ifdef POSIX_TYPES
# define USE_FCNTL
#endif
/*
* The remainder of the file should not need to be changed.