]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmaptool: add -h; don't assert on bad filename
authorSage Weil <sage@newdream.net>
Tue, 4 May 2010 16:51:36 +0000 (09:51 -0700)
committerSage Weil <sage@newdream.net>
Tue, 4 May 2010 18:33:57 +0000 (11:33 -0700)
src/osdmaptool.cc

index 21d34c0a01ff4d7fb4d4a4778057515bba1dac4a..1da08816b7e887379dfa0e739ee1488c1b2a1da1 100644 (file)
@@ -66,7 +66,9 @@ int main(int argc, const char **argv)
   bool test_crush = false;
 
   FOR_EACH_ARG(args) {
-    if (CONF_ARG_EQ("print", 'p')) {
+    if (CONF_ARG_EQ("help", 'h')) {
+      usage();
+    } else if (CONF_ARG_EQ("print", 'p')) {
       CONF_SAFE_SET_ARG_VAL(&print, OPT_BOOL);
     } else if (CONF_ARG_EQ("createsimple", '\0')) {
       createsimple = true;
@@ -107,7 +109,8 @@ int main(int argc, const char **argv)
   int r = 0;
   if (!(createsimple && clobber)) {
     r = bl.read_file(fn);
-    osdmap.decode(bl);
+    if (r >= 0)
+      osdmap.decode(bl);
   }
   char buf[80];
   if (!createsimple && r < 0) {