aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-11-09 15:04:34 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-11-09 15:04:34 +0100
commitb87f84cf55b4ca666b31c511e2489789e3322da4 (patch)
tree9372005451725bac4eff2fcdbb172247feecbb37
parent387f824cab50682e373ade49dcec4e6f99c10a42 (diff)
Fix appending to Setting<StringSet>
Fixes: warning: unknown setting 'extra-sandbox-paths'
-rw-r--r--src/libutil/config.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libutil/config.cc b/src/libutil/config.cc
index be957dfe3..7af3e7883 100644
--- a/src/libutil/config.cc
+++ b/src/libutil/config.cc
@@ -291,7 +291,14 @@ template<> std::string BaseSetting<Strings>::to_string() const
template<> void BaseSetting<StringSet>::set(const std::string & str, bool append)
{
- value = tokenizeString<StringSet>(str);
+ if (!append) value.clear();
+ for (auto & s : tokenizeString<StringSet>(str))
+ value.insert(s);
+}
+
+template<> bool BaseSetting<StringSet>::isAppendable()
+{
+ return true;
}
template<> std::string BaseSetting<StringSet>::to_string() const
@@ -302,9 +309,7 @@ template<> std::string BaseSetting<StringSet>::to_string() const
template<> void BaseSetting<StringMap>::set(const std::string & str, bool append)
{
if (!append) value.clear();
- auto kvpairs = tokenizeString<Strings>(str);
- for (auto & s : kvpairs)
- {
+ for (auto & s : tokenizeString<Strings>(str)) {
auto eq = s.find_first_of('=');
if (std::string::npos != eq)
value.emplace(std::string(s, 0, eq), std::string(s, eq + 1));