Merge pull request #531 from Barenboim/master

Fix problem when resolv.conf doesn't contain any nameserver.
This commit is contained in:
xiehan
2021-08-17 14:20:16 +08:00
committed by GitHub
+8 -10
View File
@@ -690,18 +690,16 @@ private:
std::string url;
std::string search;
if (__parse_resolv_conf(path, url, search, &ndots, &attempts,
&rotate) >= 0)
{
client = new WFDnsClient;
if (client->init(url, search, ndots, attempts, rotate) >= 0)
return;
__parse_resolv_conf(path, url, search, &ndots, &attempts, &rotate);
if (url.size() == 0)
url = "8.8.8.8";
delete client;
client = NULL;
}
client = new WFDnsClient;
if (client->init(url, search, ndots, attempts, rotate) >= 0)
return;
abort();
delete client;
client = NULL;
}
}