Skip to content

Commit

Permalink
Implement newline filter on config file read in
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Feb 23, 2020
1 parent f107dfc commit b556e81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,14 @@ void ReadConfigFile(ArgsMap& mapSettingsRet,
if (!streamConfig.good())
return; // No bitcoin.conf file is OK

boost::iostreams::filtering_istream streamFilteredConfig;
streamFilteredConfig.push(boost::iostreams::newline_filter(boost::iostreams::newline::posix));
streamFilteredConfig.push(streamConfig);

set<string> setOptions;
setOptions.insert("*");

for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it)
for (boost::program_options::detail::config_file_iterator it(streamFilteredConfig, setOptions), end; it != end; ++it)
{
// Don't overwrite existing settings so command line settings override bitcoin.conf
string strKey = string("-") + it->string_key;
Expand Down
2 changes: 2 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/thread.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/newline.hpp>

#include <compat.h>

Expand Down

0 comments on commit b556e81

Please sign in to comment.