Skip to content

Commit

Permalink
common: return null if mc.init() unsuccessful
Browse files Browse the repository at this point in the history
Prevents ceph.cc from segfaulting on missing keyring.

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
  • Loading branch information
Samuel Just authored and liewegas committed Nov 10, 2011
1 parent a177a70 commit 2a7fbe0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tools/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2a7fbe0

Please sign in to comment.