]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
monmap: return ENOENT from build_from_host_list when no mons
authorSage Weil <sage@inktank.com>
Wed, 23 May 2012 18:25:46 +0000 (11:25 -0700)
committerSage Weil <sage@inktank.com>
Wed, 23 May 2012 18:25:46 +0000 (11:25 -0700)
Make sure we return an error when no monitors are parsed.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/MonMap.cc

index ebff83763ae1dd4aa60ea4a1e4ad09b6c448f243..6dd8ec88c5a21abc047429f07771052026079eb5 100644 (file)
@@ -162,6 +162,8 @@ int MonMap::build_from_host_list(std::string hostlist, std::string prefix)
       name += n;
       add(name, addrs[i]);
     }
+    if (addrs.empty())
+      return -ENOENT;
     return 0;
   }
 
@@ -175,6 +177,9 @@ int MonMap::build_from_host_list(std::string hostlist, std::string prefix)
   if (!success)
     return -EINVAL;
 
+  if (addrs.empty())
+    return -ENOENT;
+
   for (unsigned i=0; i<addrs.size(); i++) {
     char n[2];
     n[0] = 'a' + i;