Acquire an exclusive lock before writing to any file. Note that in

some cases we never explicitly unlock a file because fclose will do
it implicitly. Closes #172.
This commit is contained in:
magnum
2016-01-29 16:48:19 +01:00
parent 2a160b2706
commit ce170ea980
4 changed files with 47 additions and 1 deletions
+1 -1
View File
@@ -28,6 +28,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <search.h>
#include <fcntl.h>
#ifdef _POSIX
#include <sys/time.h>
@@ -62,7 +63,6 @@ typedef void *HM_LIB;
#include <tchar.h>
#include <psapi.h>
#include <io.h>
#include <fcntl.h>
typedef UINT8 uint8_t;
typedef UINT16 uint16_t;
+8
View File
@@ -1832,6 +1832,14 @@ char *logfile_generate_topid ();
char *logfile_generate_subid ();
void logfile_append (const char *fmt, ...);
#if F_SETLKW
void lock_file (FILE *fp);
void unlock_file (FILE *fp);
#else
#define lock_file(dummy) {}
#define unlock_file(dummy) {}
#endif
#ifdef _WIN
void fsync (int fd);
#endif