]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rados: fix the segfault introduced in 0f7aeee
authorKefu Chai <kchai@redhat.com>
Sat, 4 Jul 2015 05:25:38 +0000 (13:25 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 4 Jul 2015 05:25:39 +0000 (13:25 +0800)
prefix and run_name should not be initialized by a temporary string

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/rados/rados.cc

index f0bb7accf7b3ac98c6c0e8298c1fd50d8f4625dc..5c7973c5777ca967f27b61cd674de5185290677b 100644 (file)
@@ -1191,8 +1191,8 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
   bool show_time = false;
   bool wildcard = false;
 
-  const char* run_name = NULL;
-  const char* prefix = NULL;
+  std::string run_name;
+  std::string prefix;
 
   Formatter *formatter = NULL;
   bool pretty_format = false;
@@ -1233,11 +1233,11 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
   }
   i = opts.find("run-name");
   if (i != opts.end()) {
-    run_name = i->second.c_str();
+    run_name = i->second;
   }
   i = opts.find("prefix");
   if (i != opts.end()) {
-    prefix = i->second.c_str();
+    prefix = i->second;
   }
   i = opts.find("block-size");
   if (i != opts.end()) {