mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-04 10:07:27 -05:00
Fix segfault when we're unable to create the lock file.
This commit is contained in:
parent
64ad448adc
commit
a925c32cca
1 changed files with 1 additions and 1 deletions
2
init.cpp
2
init.cpp
|
@ -326,7 +326,7 @@ bool AppInit2(int argc, char* argv[])
|
||||||
// Make sure only a single bitcoin process is using the data directory.
|
// Make sure only a single bitcoin process is using the data directory.
|
||||||
string strLockFile = GetDataDir() + "/.lock";
|
string strLockFile = GetDataDir() + "/.lock";
|
||||||
FILE* file = fopen(strLockFile.c_str(), "a"); // empty lock file; created if it doesn't exist.
|
FILE* file = fopen(strLockFile.c_str(), "a"); // empty lock file; created if it doesn't exist.
|
||||||
fclose(file);
|
if (file) fclose(file);
|
||||||
static boost::interprocess::file_lock lock(strLockFile.c_str());
|
static boost::interprocess::file_lock lock(strLockFile.c_str());
|
||||||
if (!lock.try_lock())
|
if (!lock.try_lock())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue