]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph-kvstore-tool: handle wrong command line argv 6093/head
authorKefu Chai <kchai@redhat.com>
Fri, 25 Sep 2015 03:33:32 +0000 (11:33 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 25 Sep 2015 03:33:32 +0000 (11:33 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/tools/ceph_kvstore_tool.cc

index a234213df8065d47412e7c23a627d54abcd8bec7..ca973d201772f9debfe653bc95efdcf8fd5f4a31 100644 (file)
@@ -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;