diff options
| author | Wladimir J. van der Laan <[email protected]> | 2018-02-13 14:12:30 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-02-15 16:24:45 +0100 |
| commit | fc888bfcacb875c45bc8f9d7ca1357ab70a30490 (patch) | |
| tree | 569fcde0c6b00df3b90bcc5a4cb5139452cfa596 /src/httpserver.cpp | |
| parent | Merge #11966: clientversion: Use full commit hash for commit-based version de... (diff) | |
| download | discoin-fc888bfcacb875c45bc8f9d7ca1357ab70a30490.tar.xz discoin-fc888bfcacb875c45bc8f9d7ca1357ab70a30490.zip | |
util: Fix multiple use of LockDirectory
This commit fixes problems with calling LockDirectory multiple times on
the same directory, or from multiple threads. It also fixes the build on
OpenBSD.
- Wrap the boost::interprocess::file_lock in a std::unique_ptr inside
the map that keeps track of per-directory locks. This fixes a build
issue with the clang 4.0.0+boost-1.58.0p8 version combo on OpenBSD
6.2, and should have no observable effect otherwise.
- Protect the locks map using a mutex.
- Make sure that only locks that are successfully acquired are inserted
in the map.
- Open the lock file for appending only if we know we don't have the
lock yet - The `FILE* file = fsbridge::fopen(pathLockFile, "a");`
wipes the 'we own this lock' administration, likely because it opens
a new fd for the locked file then closes it.
Diffstat (limited to 'src/httpserver.cpp')
0 files changed, 0 insertions, 0 deletions