From: xie xingguo Date: Mon, 6 Jun 2016 11:39:54 +0000 (+0800) Subject: auth/cephx: process formatter dump more tenderly X-Git-Tag: ses5-milestone5~239^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9eab1d99dae48ce31482e030c3a3c2f0ca9ec3ae;p=ceph.git auth/cephx: process formatter dump more tenderly E.g., if there is no secrets, we don't open a session and leave it haning after returning. Signed-off-by: xie xingguo --- diff --git a/src/auth/cephx/CephxKeyServer.cc b/src/auth/cephx/CephxKeyServer.cc index 28b143753958..8aafe07ce625 100644 --- a/src/auth/cephx/CephxKeyServer.cc +++ b/src/auth/cephx/CephxKeyServer.cc @@ -296,15 +296,14 @@ bool KeyServer::contains(const EntityName& name) const int KeyServer::encode_secrets(Formatter *f, stringstream *ds) const { Mutex::Locker l(lock); - - if (f) - f->open_array_section("auth_dump"); - map::const_iterator mapiter = data.secrets_begin(); if (mapiter == data.secrets_end()) return -ENOENT; + if (f) + f->open_array_section("auth_dump"); + while (mapiter != data.secrets_end()) { const EntityName& name = mapiter->first; if (ds) {