mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 14:45:08 +01:00
error if settings.json exists, but is unreadable
This commit is contained in:
parent
da1c0c64fd
commit
2b071265c3
@ -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>()})) {
|
||||
|
Loading…
Reference in New Issue
Block a user