From b99921746ef2e1e15777c748a15e929c72888db1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 15 Aug 2013 14:36:57 -0700 Subject: [PATCH] config: fix stringification of config values The std::copy construct leaves a trailing separator character, which breaks parsing for booleans (among other things) and probably mangles everything else too. Backport: dumpling Signed-off-by: Sage Weil Reviewed-by: Samuel Just (cherry picked from commit fc23cfe3fe567b30413d8af0c614a32fec238939) --- src/common/ceph_context.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 9602fdf2e40d8..e694a2f09b393 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -26,6 +26,7 @@ #include "common/Formatter.h" #include "log/Log.h" #include "auth/Crypto.h" +#include "include/str_list.h" #include #include @@ -197,11 +198,10 @@ void CephContext::do_command(std::string command, cmdmap_t& cmdmap, f->dump_string("error", "syntax error: 'config set '"); } else { // val may be multiple words - ostringstream argss; - std::copy(val.begin(), val.end(), ostream_iterator(argss, " ")); - int r = _conf->set_val(var.c_str(), argss.str().c_str()); + string valstr = str_join(val, " "); + int r = _conf->set_val(var.c_str(), valstr.c_str()); if (r < 0) { - f->dump_stream("error") << "error setting '" << var << "' to '" << val << "': " << cpp_strerror(r); + f->dump_stream("error") << "error setting '" << var << "' to '" << valstr << "': " << cpp_strerror(r); } else { ostringstream ss; _conf->apply_changes(&ss); -- 2.39.5