]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tool: do not core dump with a invalid kv type 16745/head
authorChang Liu <liuchang0812@gmail.com>
Tue, 10 Oct 2017 11:39:48 +0000 (19:39 +0800)
committerChang Liu <liuchang0812@gmail.com>
Mon, 16 Oct 2017 14:52:10 +0000 (22:52 +0800)
Fixes: http://tracker.ceph.com/issues/21744
Signed-off-by: Chang Liu <liuchang0812@gmail.com>
src/tools/ceph_kvstore_tool.cc

index 8cd3afd56e367f5fda5d5ebb614b90c7bf0e5b89..90a8798b7fdc91d71a1f84a03a2ed7df40843d77 100644 (file)
@@ -334,6 +334,15 @@ int main(int argc, const char *argv[])
   string path(args[1]);
   string cmd(args[2]);
 
+  if (type != "leveldb" &&
+      type != "rocksdb" &&
+      type != "bluestore-kv")  {
+
+    std::cerr << "Unrecognized type: " << args[0] << std::endl;
+    usage(argv[0]);
+    return 1;
+  }
+
   bool need_open_db = (cmd != "repair");
   StoreTool st(type, path, need_open_db);