Do not crash on empty matched_addrs

test-assert
Vitaliy Filippov 2021-12-10 11:40:59 +03:00
parent 5a234588b9
commit b376ef2ed9
1 changed files with 8 additions and 0 deletions

View File

@ -179,6 +179,14 @@ void osd_t::bind_socket()
fprintf(stderr, "More than 1 address matches requested network(s): %s\n", json11::Json(matched_addrs).dump().c_str());
force_stop(1);
}
if (!matched_addrs.size())
{
std::string nets;
for (auto v: mask)
nets += (nets == "" ? v : ","+v);
fprintf(stderr, "Addresses matching osd_network(s) %s not found\n", nets.c_str());
force_stop(1);
}
bind_address = matched_addrs[0];
}