changeset 550:5159a6337187 draft

Merge pull request #179 from wizeman/segfault-lockfile. Fix segfault when we're unable to create the lock file.
author Gavin Andresen <gavinandresen@gmail.com>
date Sun, 01 May 2011 06:41:49 -0700
parents 598172ac080f (current diff) 7a3cb21d8a8f (diff)
children 4fd541f60ba5 01057e91a15b
files
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/init.cpp
+++ b/init.cpp
@@ -326,7 +326,7 @@
     // 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())
     {