Merge pull request #179 from wizeman/segfault-lockfile.

Fix segfault when we're unable to create the lock file.
This commit is contained in:
Gavin Andresen 2011-05-01 06:41:49 -07:00
commit 76160f784a

View file

@ -326,7 +326,7 @@ bool AppInit2(int argc, char* argv[])
// Make sure only a single bitcoin process is using the data directory.
string strLockFile = GetDataDir() + "/.lock";
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());
if (!lock.try_lock())
{