Skip to content

Commit 62fe466

Browse files
jonasschnellirecursive-rat4
authored andcommitted
clear path cache after getting a proper config file (fixes #2605)
Signed-off-by: Jonas Schnelli <jonas.schnelli@include7.ch> Conflicts: src/util.cpp
1 parent 455dcd9 commit 62fe466

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/util.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ bool fNoListen = false;
7373
bool fLogTimestamps = false;
7474
CMedianFilter<int64_t> vTimeOffsets(200,0);
7575
bool fReopenDebugLog = false;
76+
bool fCachedPath[2] = {false, false};
7677

7778
// Init OpenSSL library multithreading support
7879
static CCriticalSection** ppmutexOpenSSL;
@@ -1018,13 +1019,12 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
10181019

10191020
static fs::path pathCached[2];
10201021
static CCriticalSection csPathCached;
1021-
static bool cachedPath[2] = {false, false};
10221022

10231023
fs::path &path = pathCached[fNetSpecific];
10241024

10251025
// This can be called during exceptions by printf, so we cache the
10261026
// value so we don't have to do memory allocations after that.
1027-
if (cachedPath[fNetSpecific])
1027+
if (fCachedPath[fNetSpecific])
10281028
return path;
10291029

10301030
LOCK(csPathCached);
@@ -1043,7 +1043,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
10431043

10441044
fs::create_directory(path);
10451045

1046-
cachedPath[fNetSpecific]=true;
1046+
fCachedPath[fNetSpecific] = true;
10471047
return path;
10481048
}
10491049

@@ -1061,6 +1061,9 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
10611061
if (!streamConfig.good())
10621062
return; // No bitcoin.conf file is OK
10631063

1064+
// clear path cache after loading config file
1065+
fCachedPath[0] = fCachedPath[1] = false;
1066+
10641067
set<string> setOptions;
10651068
setOptions.insert("*");
10661069

0 commit comments

Comments
 (0)