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:
+1
-1
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user