]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
monmaptool: Return a non-zero error code and print a useful error
authorSamuel Just <samuelj@hq.newdream.net>
Tue, 23 Nov 2010 20:25:11 +0000 (12:25 -0800)
committerSamuel Just <samuelj@hq.newdream.net>
Tue, 23 Nov 2010 20:26:38 +0000 (12:26 -0800)
message if unable to read the monmap file.

Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
src/monmaptool.cc

index 2c6f8ecb6793fc708a18d066813b534f90ae1155..36def640f378d8ac48410ffc6aa6b7906c41966e 100644 (file)
@@ -89,8 +89,14 @@ int main(int argc, const char **argv)
   cout << me << ": monmap file " << fn << std::endl;
 
   int r = 0;
-  if (!(create && clobber))
-    r = monmap.read(fn);
+  if (!(create && clobber)) {
+    try {
+      r = monmap.read(fn);
+    } catch (...) {
+      cerr << me << ": unable to read monmap file" << std::endl;
+      return -1;
+    }
+  }
 
   char buf[80];
   if (!create && r < 0) {