From 22259c6efda9a5d55221fd036c757bf123796753 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Wed, 8 Aug 2012 15:24:57 -0700 Subject: [PATCH] MonMap: return error on failure in build_initial If mon_host fails to parse, return an error instead of success. This avoids failing later on an assert monmap.size() > 0 in the monmap in MonClient. Fixes: #2913 Signed-off-by: Josh Durgin --- src/mon/MonMap.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mon/MonMap.cc b/src/mon/MonMap.cc index 6dd8ec88c5a2..88666cb4cbc8 100644 --- a/src/mon/MonMap.cc +++ b/src/mon/MonMap.cc @@ -265,8 +265,11 @@ int MonMap::build_initial(CephContext *cct, ostream& errout) // -m foo? if (!conf->mon_host.empty()) { int r = build_from_host_list(conf->mon_host, "noname-"); - if (r < 0) - errout << "unable to parse addrs in '" << conf->mon_host << "'" << std::endl; + if (r < 0) { + errout << "unable to parse addrs in '" << conf->mon_host << "'" + << std::endl; + return r; + } return 0; } -- 2.47.3