From: Kefu Chai Date: Fri, 25 Sep 2015 03:33:32 +0000 (+0800) Subject: tools/ceph-kvstore-tool: handle wrong command line argv X-Git-Tag: v10.0.2~174^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4a0e56f170836f0de34e647a65af54b29ea5b9d6;p=ceph.git tools/ceph-kvstore-tool: handle wrong command line argv Signed-off-by: Kefu Chai --- diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index a234213df806..ca973d201772 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;