aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <[email protected]>2018-10-19 18:59:28 -0700
committerPieter Wuille <[email protected]>2018-10-19 18:59:47 -0700
commitb2863c0685a5c12f829095cbabaf26ccc49e46ec (patch)
tree9cde62a6d4c083e6d1088d3165aa17c3bde1f84e /src
parentMerge #14513: Avoid 1 << 31 (UB) in calculation of SEQUENCE_LOCKTIME_DISABLE_... (diff)
parentutils: Fix broken Windows filelock (diff)
downloaddiscoin-b2863c0685a5c12f829095cbabaf26ccc49e46ec.tar.xz
discoin-b2863c0685a5c12f829095cbabaf26ccc49e46ec.zip
Merge #14426: utils: Fix broken Windows filelock
369244f654 utils: Fix broken Windows filelock (Chun Kuan Lee) Pull request description: Fix broken filelock on Windows, also add a test for this. It's a regression introduced by #13862. Tree-SHA512: 15665b1930cf39ec71f3ab07def8e2897659f6fd4d2de749d63a5a8ec920e4a04282f12bc262f242b1b3d14d2dd9fa191ddbcf16a46fb927b5b2b14d9f6b5d01
Diffstat (limited to 'src')
-rw-r--r--src/fs.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fs.cpp b/src/fs.cpp
index a146107c4..3c8f4c024 100644
--- a/src/fs.cpp
+++ b/src/fs.cpp
@@ -3,6 +3,7 @@
#ifndef WIN32
#include <fcntl.h>
#else
+#define NOMINMAX
#include <codecvt>
#include <windows.h>
#endif
@@ -89,7 +90,7 @@ bool FileLock::TryLock()
return false;
}
_OVERLAPPED overlapped = {0};
- if (!LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, 0, 0, &overlapped)) {
+ if (!LockFileEx(hFile, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, std::numeric_limits<DWORD>::max(), std::numeric_limits<DWORD>::max(), &overlapped)) {
reason = GetErrorReason();
return false;
}