Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: net/dns/dns_config_service_posix.cc

Issue 8336024: OpenBSD patches for net, split from CR #8275005 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix comment Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/dns/dns_config_service_posix.h ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_config_service_posix.cc
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
index 0224c39cb9ec0273a79f5b4d86efe7983f803776..3385c52c3e479fe296cc3dcc897cd7e8f6c6fce8 100644
--- a/net/dns/dns_config_service_posix.cc
+++ b/net/dns/dns_config_service_posix.cc
@@ -30,16 +30,22 @@ class DnsConfigServicePosix::ConfigReader : public SerialWorker {
success_(false) {}
void DoWork() OVERRIDE {
+#if defined(OS_OPENBSD)
+ if ((res_init() == 0) && (_res.options & RES_INIT)) {
+ success_ = ConvertResToConfig(_res, &dns_config_);
+#else
struct __res_state res;
if ((res_ninit(&res) == 0) && (res.options & RES_INIT)) {
success_ = ConvertResToConfig(res, &dns_config_);
+#endif
} else {
// Note: res_ninit in glibc always returns 0 and sets RES_INIT.
+ // res_init behaves the same way.
success_ = false;
}
#if defined(OS_MACOSX)
res_ndestroy(&res);
-#else
+#elif !defined(OS_OPENBSD)
res_nclose(&res);
#endif
}
@@ -123,7 +129,9 @@ bool ConvertResToConfig(const struct __res_state& res, DnsConfig* dns_config) {
dns_config->ndots = res.ndots;
dns_config->timeout = base::TimeDelta::FromSeconds(res.retrans);
dns_config->attempts = res.retry;
+#if defined(RES_ROTATE)
dns_config->rotate = res.options & RES_ROTATE;
+#endif
dns_config->edns0 = res.options & RES_USE_EDNS0;
return true;
« no previous file with comments | « net/dns/dns_config_service_posix.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698