]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: properly decode features when using image name optional 15492/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 5 Jun 2017 17:17:19 +0000 (13:17 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 5 Jun 2017 17:17:19 +0000 (13:17 -0400)
Fixes: http://tracker.ceph.com/issues/20185
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/tools/rbd/action/Feature.cc

index 94a800b76f94e58ae58dd8db21063163294ee48e..45d4fcb4ff5c7418b99a014ba1bbfd3c808e18b6 100644 (file)
@@ -56,9 +56,14 @@ int execute(const po::variables_map &vm, bool enabled) {
     return r;
   }
 
-  const std::vector<std::string> &args = vm[at::POSITIONAL_ARGUMENTS]
-    .as<std::vector<std::string> >();
-  std::vector<std::string> feature_names(args.begin() + 1, args.end());
+  std::vector<std::string> feature_names;
+  if (vm.count(at::POSITIONAL_ARGUMENTS)) {
+    const std::vector<std::string> &args =
+      vm[at::POSITIONAL_ARGUMENTS].as<std::vector<std::string> >();
+    feature_names.insert(feature_names.end(), args.begin() + arg_index,
+                         args.end());
+  }
+
   if (feature_names.empty()) {
     std::cerr << "rbd: at least one feature name must be specified"
               << std::endl;