From 4a0e56f170836f0de34e647a65af54b29ea5b9d6 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 25 Sep 2015 11:33:32 +0800 Subject: [PATCH] tools/ceph-kvstore-tool: handle wrong command line argv Signed-off-by: Kefu Chai --- src/tools/ceph_kvstore_tool.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index a234213df80..ca973d20177 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -289,13 +289,16 @@ int main(int argc, const char *argv[]) if (argc >= 7) { string subcmd(argv[6]); - string out(argv[7]); - if (subcmd != "out") { std::cerr << "unrecognized subcmd '" << subcmd << "'" << std::endl; return 1; } + if (argc < 8) { + std::cerr << "output path not specified" << std::endl; + return 1; + } + string out(argv[7]); if (out.empty()) { std::cerr << "unspecified out file" << std::endl; -- 2.47.3