@@ -73,6 +73,7 @@ bool fNoListen = false;
7373bool fLogTimestamps = false ;
7474CMedianFilter<int64_t > vTimeOffsets (200 ,0 );
7575bool fReopenDebugLog = false ;
76+ bool fCachedPath [2 ] = {false , false };
7677
7778// Init OpenSSL library multithreading support
7879static 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