diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 18:32:52 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-27 18:32:52 +0000 |
commit | 776f67ff177c12ba85f2095c8930ab90c577c79b (patch) | |
tree | eab6c22f5a6675532d040197588bffffcc907b8a /net | |
parent | cb38c0b2744aa2598def84fa36e639cac3e347cb (diff) | |
download | chromium_src-776f67ff177c12ba85f2095c8930ab90c577c79b.zip chromium_src-776f67ff177c12ba85f2095c8930ab90c577c79b.tar.gz chromium_src-776f67ff177c12ba85f2095c8930ab90c577c79b.tar.bz2 |
Work around linux resolver problem where changes to resolv.conf go unnoticed in some distributions.
BUG=11380
TEST=Start chrome with empty resolv.conf, fix resolv.conf; chrome should
be able to resolve sites.
Review URL: http://codereview.chromium.org/113904
Patch from Craig Schlenter <craig.schlenter@gmail.com>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/host_resolver.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc index 873fdcd..23a1c00 100644 --- a/net/base/host_resolver.cc +++ b/net/base/host_resolver.cc @@ -11,6 +11,9 @@ #include <netdb.h> #include <sys/socket.h> #endif +#if defined(OS_LINUX) +#include <resolv.h> +#endif #include "base/message_loop.h" #include "base/string_util.h" @@ -72,6 +75,13 @@ static int HostResolverProc( hints.ai_socktype = SOCK_STREAM; int err = getaddrinfo(host.c_str(), port.c_str(), &hints, out); +#if defined(OS_LINUX) + // If we fail, re-initialise the resolver just in case there have been any + // changes to /etc/resolv.conf and retry. See http://crbug.com/11380 for info. + if (err && !res_init()) + err = getaddrinfo(host.c_str(), port.c_str(), &hints, out); +#endif + return err ? ERR_NAME_NOT_RESOLVED : OK; } |