From b357a71cfaf99dd2e7d203a12edfcc5df4a93386 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Thu, 2 May 2013 18:55:25 +0200 Subject: clear path cache after getting a proper config file (fixes #2605) Signed-off-by: Jonas Schnelli --- src/util.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/util.cpp') diff --git a/src/util.cpp b/src/util.cpp index 8b6d8b32c..4c9b897f5 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -83,6 +83,7 @@ bool fNoListen = false; bool fLogTimestamps = false; CMedianFilter vTimeOffsets(200,0); volatile bool fReopenDebugLog = false; +bool fCachedPath[2] = {false, false}; // Init OpenSSL library multithreading support static CCriticalSection** ppmutexOpenSSL; @@ -1048,13 +1049,12 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) static fs::path pathCached[2]; static CCriticalSection csPathCached; - static bool cachedPath[2] = {false, false}; fs::path &path = pathCached[fNetSpecific]; // This can be called during exceptions by printf, so we cache the // value so we don't have to do memory allocations after that. - if (cachedPath[fNetSpecific]) + if (fCachedPath[fNetSpecific]) return path; LOCK(csPathCached); @@ -1073,7 +1073,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) fs::create_directory(path); - cachedPath[fNetSpecific] = true; + fCachedPath[fNetSpecific] = true; return path; } @@ -1091,6 +1091,9 @@ void ReadConfigFile(map& mapSettingsRet, if (!streamConfig.good()) return; // No bitcoin.conf file is OK + // clear path cache after loading config file + fCachedPath[0] = fCachedPath[1] = false; + set setOptions; setOptions.insert("*"); -- cgit v1.2.3 From 3260b4c09006ea5c1b00c599a14e6c706ac760f8 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Sun, 28 Apr 2013 17:37:50 +0200 Subject: remove GetBoolArg() fDefault parameter defaulting to false - explicitly set the default of all GetBoolArg() calls - rework getarg_test.cpp and util_tests.cpp to cover this change - some indentation fixes - move macdockiconhandler.h include in bitcoin.cpp to the "our headers" section --- src/util.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/util.cpp') diff --git a/src/util.cpp b/src/util.cpp index 4c9b897f5..0bd296023 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -518,7 +518,7 @@ static void InterpretNegativeSetting(string name, map& mapSettin positive.append(name.begin()+3, name.end()); if (mapSettingsRet.count(positive) == 0) { - bool value = !GetBoolArg(name); + bool value = !GetBoolArg(name, false); mapSettingsRet[positive] = (value ? "1" : "0"); } } @@ -1171,7 +1171,6 @@ bool TruncateFile(FILE *file, unsigned int length) { #endif } - // this function tries to raise the file descriptor limit to the requested number. // It returns the actual file descriptor limit (which may be more or less than nMinFD) int RaiseFileDescriptorLimit(int nMinFD) { @@ -1257,8 +1256,8 @@ void ShrinkDebugFile() fclose(file); } } - else if(file != NULL) - fclose(file); + else if (file != NULL) + fclose(file); } -- cgit v1.2.3