From a925c32cca224bf8d839fa420c524213c6cb340f Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Sat, 23 Apr 2011 01:26:16 +0200 Subject: Fix segfault when we're unable to create the lock file. --- init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init.cpp') diff --git a/init.cpp b/init.cpp index 8f72181225..a8e93140b3 100644 --- a/init.cpp +++ b/init.cpp @@ -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()) { -- cgit v1.2.3