diff options
| author | Wladimir J. van der Laan <[email protected]> | 2018-05-14 16:38:18 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-05-14 16:39:07 +0200 |
| commit | 682698970d453410fb2f7bd7eac060c0e63056f9 (patch) | |
| tree | 29ee7f2ad86235c7e44c0972252ddb0350130b5a /src | |
| parent | Merge #11689: mempool: Fix missing locking in CTxMemPool::check(…) and CTxM... (diff) | |
| parent | test: Ensure that recursive -includeconf produces appropriate warnings (diff) | |
| download | discoin-682698970d453410fb2f7bd7eac060c0e63056f9.tar.xz discoin-682698970d453410fb2f7bd7eac060c0e63056f9.zip | |
Merge #13197: util: warn about ignored recursive -includeconf calls
2352aa9 test: Ensure that recursive -includeconf produces appropriate warnings (Karl-Johan Alm)
c5bcc7d util: warn about recursive -includeconf arguments in configuration files (Karl-Johan Alm)
Pull request description:
This is a follow-up PR to #10267, and addresses https://github.com/bitcoin/bitcoin/pull/10267#issuecomment-387546144.
~~I am adding extra work for @jnewbery in #12755 here -- maybe I should just rebase on top of that, but not sure what the appropriate approach is here.~~
Tree-SHA512: 87f0c32436b70424e33616ffb88d7cb699f90d6a583a10237e224b28fc936d6a9df95536c8c52ee8546b3942da92b2a357e61bf87e00d1462bc10d46d3bee352
Diffstat (limited to 'src')
| -rw-r--r-- | src/util.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp index 7dd6884f7..6a2b2c1ed 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -790,6 +790,14 @@ void ArgsManager::ReadConfigFiles() includeconf.insert(includeconf.end(), includeconf_net.begin(), includeconf_net.end()); } + // Remove -includeconf from configuration, so we can warn about recursion + // later + { + LOCK(cs_args); + m_config_args.erase("-includeconf"); + m_config_args.erase(std::string("-") + GetChainName() + ".includeconf"); + } + for (const std::string& to_include : includeconf) { fs::ifstream include_config(GetConfigFile(to_include)); if (include_config.good()) { @@ -799,6 +807,16 @@ void ArgsManager::ReadConfigFiles() fprintf(stderr, "Failed to include configuration file %s\n", to_include.c_str()); } } + + // Warn about recursive -includeconf + includeconf = GetArgs("-includeconf"); + { + std::vector<std::string> includeconf_net(GetArgs(std::string("-") + GetChainName() + ".includeconf")); + includeconf.insert(includeconf.end(), includeconf_net.begin(), includeconf_net.end()); + } + for (const std::string& to_include : includeconf) { + fprintf(stderr, "warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n", to_include.c_str()); + } } } |