]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd:improve the error handle of rbd,check the return value. 5558/head
authors09816 <shi.lu@h3c.com>
Sat, 15 Aug 2015 02:31:57 +0000 (22:31 -0400)
committers09816 <shi.lu@h3c.com>
Sat, 15 Aug 2015 02:32:18 +0000 (22:32 -0400)
Signed-off-by: s09816 <shi.lu@h3c.com>
src/rbd.cc [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index fb399b1..f8eedb0
@@ -3097,7 +3097,10 @@ int main(int argc, const char **argv)
        return EXIT_FAILURE;
       }
       format_specified = true;
-      g_conf->set_val_or_die("rbd_default_format", val.c_str());
+      if (0 != g_conf->set_val("rbd_default_format", val.c_str())) {
+        cerr << "rbd: image format must be 1 or 2" << std::endl;
+        return EXIT_FAILURE;
+      }
     } else if (ceph_argparse_witharg(args, i, &val, "-p", "--pool", (char*)NULL)) {
       poolname = strdup(val.c_str());
     } else if (ceph_argparse_witharg(args, i, &val, "--dest-pool", (char*)NULL)) {