From 71fcff2edc8ec5022cf90c46a7f796d2c63ae416 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Tue, 10 Oct 2017 19:39:48 +0800 Subject: [PATCH] tool: do not core dump with a invalid kv type Fixes: http://tracker.ceph.com/issues/21744 Signed-off-by: Chang Liu --- src/tools/ceph_kvstore_tool.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index 8cd3afd56e3..90a8798b7fd 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -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); -- 2.39.5