]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: return null if mc.init() unsuccessful
authorSamuel Just <samuel.just@dreamhost.com>
Mon, 7 Nov 2011 23:04:02 +0000 (15:04 -0800)
committerSage Weil <sage@newdream.net>
Thu, 10 Nov 2011 23:05:52 +0000 (15:05 -0800)
Prevents ceph.cc from segfaulting on missing keyring.

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/tools/common.cc

index 3dfa3e2b0fe5ffd23ebdf19ff6efc8b75796178a..38d2e7c72c443de26b5af7e39eacc2200aada65b 100644 (file)
@@ -618,13 +618,15 @@ CephToolCtx* ceph_tool_common_init(ceph_tool_mode_t mode, bool concise)
   ctx->dispatcher = new Admin(ctx.get());
   messenger->add_dispatcher_head(ctx->dispatcher);
 
+  ctx->mc.set_messenger(messenger);
+  int r = ctx->mc.init();
+  if (r < 0)
+    return NULL;
+
   ctx->lock.Lock();
   ctx->timer.init();
   ctx->lock.Unlock();
 
-  ctx->mc.set_messenger(messenger);
-  ctx->mc.init();
-
   // in case we 'tell ...'
   ctx->mc.set_want_keys(CEPH_ENTITY_TYPE_MDS | CEPH_ENTITY_TYPE_OSD);