From: Chang Liu Date: Tue, 10 Oct 2017 11:39:48 +0000 (+0800) Subject: tool: do not core dump with a invalid kv type X-Git-Tag: v13.0.1~536^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=71fcff2edc8ec5022cf90c46a7f796d2c63ae416;p=ceph-ci.git tool: do not core dump with a invalid kv type Fixes: http://tracker.ceph.com/issues/21744 Signed-off-by: Chang Liu --- 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);