aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-06-13 23:35:47 +0000
committerUlrich Drepper <drepper@redhat.com>2008-06-13 23:35:47 +0000
commitd0a1ae946455e137711790c885d6e8a05a37efd0 (patch)
tree7022588243053771af30df2a51dbe99d41786bd2
parenta0edbb484a9b8988ba6996436d5abac0e572377f (diff)
downloadglibc-d0a1ae946455e137711790c885d6e8a05a37efd0.tar
glibc-d0a1ae946455e137711790c885d6e8a05a37efd0.tar.gz
glibc-d0a1ae946455e137711790c885d6e8a05a37efd0.tar.bz2
glibc-d0a1ae946455e137711790c885d6e8a05a37efd0.zip
* sysdeps/posix/getaddrinfo.c: Move _res_hconf_init call to a
better place so it is not called when nscd is used.
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/posix/getaddrinfo.c30
2 files changed, 12 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 28c67c0f6c..70017e5e76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2008-06-13 Ulrich Drepper <drepper@redhat.com>
+ * sysdeps/posix/getaddrinfo.c: Move _res_hconf_init call to a
+ better place so it is not called when nscd is used.
+
* nscd/connections.c: Also recognize and handle changes to the
resolver configuration file.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 5c82b5274a..4987505c5e 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -684,6 +684,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
"dns [!UNAVAIL=return] files",
&nip);
+ /* Initialize configurations. */
+ if (__builtin_expect (!_res_hconf.initialized, 0))
+ _res_hconf_init ();
if (__res_maybe_init (&_res, 0) == -1)
no_more = 1;
@@ -883,9 +886,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
}
- if (pai == NULL)
- return 0;
-
{
struct gaih_servtuple *st2;
struct gaih_addrtuple *at2 = at;
@@ -2091,10 +2091,6 @@ getaddrinfo (const char *name, const char *service,
if ((hints->ai_flags & AI_CANONNAME) && name == NULL)
return EAI_BADFLAGS;
- /* Initialize configurations. */
- if (__builtin_expect (!_res_hconf.initialized, 0))
- _res_hconf_init ();
-
struct in6addrinfo *in6ai = NULL;
size_t in6ailen = 0;
bool seen_ipv4 = false;
@@ -2149,11 +2145,7 @@ getaddrinfo (const char *name, const char *service,
else
pservice = NULL;
- struct addrinfo **end;
- if (pai)
- end = &p;
- else
- end = NULL;
+ struct addrinfo **end = &p;
unsigned int naddrs = 0;
if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
@@ -2167,12 +2159,11 @@ getaddrinfo (const char *name, const char *service,
return -(last_i & GAIH_EAI);
}
- if (end)
- while (*end)
- {
- end = &((*end)->ai_next);
- ++nresults;
- }
+ while (*end)
+ {
+ end = &((*end)->ai_next);
+ ++nresults;
+ }
}
else
{
@@ -2368,9 +2359,6 @@ getaddrinfo (const char *name, const char *service,
return 0;
}
- if (pai == NULL && last_i == 0)
- return 0;
-
return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME;
}
libc_hidden_def (getaddrinfo)