diff options
author | Sage Weil <sage@inktank.com> | 2013-08-15 14:36:57 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-15 14:36:57 -0700 |
commit | fc23cfe3fe567b30413d8af0c614a32fec238939 (patch) | |
tree | b9c009bcea0226bdb67b44a04da96d542bb3fe7d | |
parent | ce3a0944d9b47f7b178fe7775c9d105305b238e0 (diff) | |
download | ceph-fc23cfe3fe567b30413d8af0c614a32fec238939.tar.gz |
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 <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
-rw-r--r-- | src/common/ceph_context.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 9602fdf2e40..e694a2f09b3 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 <iostream> #include <pthread.h> @@ -197,11 +198,10 @@ void CephContext::do_command(std::string command, cmdmap_t& cmdmap, f->dump_string("error", "syntax error: 'config set <var> <value>'"); } else { // val may be multiple words - ostringstream argss; - std::copy(val.begin(), val.end(), ostream_iterator<string>(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); |