changeset 541:7a3cb21d8a8f draft

Fix segfault when we're unable to create the lock file.
author Ricardo M. Correia <rcorreia@wizy.org>
date Sat, 23 Apr 2011 01:26:16 +0200
parents 53c2c6ebeaaa
children 5159a6337187
files init.cpp
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())
     {