diff options
| author | Jonas Schnelli <[email protected]> | 2013-06-03 15:18:41 +0200 |
|---|---|---|
| committer | Jonas Schnelli <[email protected]> | 2013-06-03 15:18:41 +0200 |
| commit | 39fe9de6b2b255969971beca8fa25a33ad2e5750 (patch) | |
| tree | 6686041f6b801d0ea5185b026a480a5be61510e6 /src/util.cpp | |
| parent | MaxOSX: settings fixes (#2371) (diff) | |
| parent | Merge pull request #2672 from Diapolo/Qt_testnet (diff) | |
| download | discoin-39fe9de6b2b255969971beca8fa25a33ad2e5750.tar.xz discoin-39fe9de6b2b255969971beca8fa25a33ad2e5750.zip | |
Merge branch 'master' of git://github.com/bitcoin/bitcoin into prefsFix
Signed-off-by: Jonas Schnelli <[email protected]>
Conflicts:
bitcoin-qt.pro
Diffstat (limited to 'src/util.cpp')
| -rw-r--r-- | src/util.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/util.cpp b/src/util.cpp index 8b6d8b32c..0bd296023 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -83,6 +83,7 @@ bool fNoListen = false; bool fLogTimestamps = false; CMedianFilter<int64> vTimeOffsets(200,0); volatile bool fReopenDebugLog = false; +bool fCachedPath[2] = {false, false}; // Init OpenSSL library multithreading support static CCriticalSection** ppmutexOpenSSL; @@ -517,7 +518,7 @@ static void InterpretNegativeSetting(string name, map<string, string>& 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"); } } @@ -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<string, string>& mapSettingsRet, if (!streamConfig.good()) return; // No bitcoin.conf file is OK + // clear path cache after loading config file + fCachedPath[0] = fCachedPath[1] = false; + set<string> setOptions; setOptions.insert("*"); @@ -1168,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) { @@ -1254,8 +1256,8 @@ void ShrinkDebugFile() fclose(file); } } - else if(file != NULL) - fclose(file); + else if (file != NULL) + fclose(file); } |