]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: properly decode features when using image name optional 16295/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 5 Jun 2017 17:17:19 +0000 (13:17 -0400)
committerNathan Cutler <ncutler@suse.com>
Wed, 12 Jul 2017 18:43:54 +0000 (20:43 +0200)
Fixes: http://tracker.ceph.com/issues/20185
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit f1b05a2b062a59ec1b6682f7683bfd816433a931)

src/tools/rbd/action/Feature.cc

index d1b6d1fd50d4d6e352fcd0d748ec0dccb469b834..de48917ff59de4b23cab0e8b0d5ec06effe469dc 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;