diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2018-10-19 18:59:28 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2018-10-19 18:59:47 -0700 |
commit | b2863c0685a5c12f829095cbabaf26ccc49e46ec (patch) | |
tree | 9cde62a6d4c083e6d1088d3165aa17c3bde1f84e /src | |
parent | b14db5abab405a708f0166293f1ea12222a6bf03 (diff) | |
parent | 369244f654c9e36b803e841eb30fd0aa2960087a (diff) | |
download | bitcoin-b2863c0685a5c12f829095cbabaf26ccc49e46ec.tar.xz |
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.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fs.cpp b/src/fs.cpp index a146107c4c..3c8f4c0247 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; } |