From: songbaisen Date: Wed, 27 Jul 2016 02:01:31 +0000 (+0800) Subject: tools: fix the core dump when get the crushmap do not exist X-Git-Tag: ses5-milestone5~88^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F10451%2Fhead;p=ceph.git tools: fix the core dump when get the crushmap do not exist Signed-off-by:song baisen --- diff --git a/src/tools/ceph_monstore_tool.cc b/src/tools/ceph_monstore_tool.cc index f9b4696c527d..347fb9e84d37 100644 --- a/src/tools/ceph_monstore_tool.cc +++ b/src/tools/ceph_monstore_tool.cc @@ -697,9 +697,11 @@ int main(int argc, char **argv) { } else if (map_type == "crushmap") { bufferlist tmp; r = st.get("osdmap", st.combine_strings("full", v), tmp); - OSDMap osdmap; - osdmap.decode(tmp); - osdmap.crush->encode(bl); + if (r >= 0) { + OSDMap osdmap; + osdmap.decode(tmp); + osdmap.crush->encode(bl); + } } else { r = st.get(map_type, v, bl); }