This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[BZ #15890][PATCH] Initialize res_hconf in nscd
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 26 Aug 2013 12:06:50 +0530
- Subject: [BZ #15890][PATCH] Initialize res_hconf in nscd
- Authentication-results: sourceware.org; auth=none
Hi,
res_hconf is not initialized in aicache.c, due to which queries that
get resolved from /etc/hosts return only IPv4 results for AF_UNSPEC
when queried via nscd. This persists till the entry is pruned after
TTL or the cache is invalidated. Attached patch fixes this. Tested
on x86_64. OK to commit?
Siddhesh
[BZ #15890]
* nscd/aicache.c: Include res_hconf.h.
(addhstaiX): Initialize res_hconf.
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 0461b83..dceb4d6 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -25,6 +25,7 @@
#include <time.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <resolv/res_hconf.h>
#include "dbg_log.h"
#include "nscd.h"
@@ -100,6 +101,9 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
no_more = __nss_database_lookup ("hosts", NULL,
"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;