fix compile error on macos and exclude excluded interface

This commit is contained in:
Jeff Becker 2020-08-10 14:18:20 -04:00
parent c2e484d14b
commit 778792f8fc
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
1 changed files with 4 additions and 2 deletions

View File

@ -395,7 +395,7 @@ GetGatewaysNotOnInterface(std::string ifname)
while ((read = getline(&line, &len, p)) != -1)
{
std::string line_str(line, len);
if (line_str.find("default") == line_str.begin())
if (line_str.find("default") == 0)
{
line_str = line_str.substr(7);
while (line_str[0] == ' ')
@ -405,7 +405,9 @@ GetGatewaysNotOnInterface(std::string ifname)
const auto pos = line_str.find(" ");
if (pos != std::string::npos)
{
gateways.emplace_back(line_str.substr(0, pos));
auto gateway = line_str.substr(0, pos);
if (gateway != interface)
gateways.emplace_back(std::move(gateway));
}
}
}