diff options
author | Tyler Chambers <me@tylerchambers.net> | 2021-07-30 14:26:37 -0400 |
---|---|---|
committer | Tyler Chambers <me@tylerchambers.net> | 2021-07-31 09:33:53 -0400 |
commit | 2b071265c37da22f15769945fd159b50a14792a3 (patch) | |
tree | 8b7ec3c99426997550e949d152f5acd32a7fb9f5 /src/util/settings.cpp | |
parent | da1c0c64fd094880712d1c4167ad9eb3bb6ffcc6 (diff) | |
download | bitcoin-2b071265c37da22f15769945fd159b50a14792a3.tar.xz |
error if settings.json exists, but is unreadable
Diffstat (limited to 'src/util/settings.cpp')
-rw-r--r-- | src/util/settings.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/util/settings.cpp b/src/util/settings.cpp index b92b1d30c3..846b34089d 100644 --- a/src/util/settings.cpp +++ b/src/util/settings.cpp @@ -60,9 +60,15 @@ bool ReadSettings(const fs::path& path, std::map<std::string, SettingsValue>& va values.clear(); errors.clear(); + // Ok for file to not exist + if (!fs::exists(path)) return true; + fsbridge::ifstream file; file.open(path); - if (!file.is_open()) return true; // Ok for file not to exist. + if (!file.is_open()) { + errors.emplace_back(strprintf("%s. Please check permissions.", path.string())); + return false; + } SettingsValue in; if (!in.read(std::string{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()})) { |