From a14d7f993829bbc538d76b18f8935e67cffa3bfe Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 13 Feb 2008 16:57:02 +0100 Subject: [PATCH] Call res_init() only once. This avoids perpetual re-reading of /etc/resolv.conf. --- lib/names-net.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/names-net.c b/lib/names-net.c index 335bf68..d96cc4d 100644 --- a/lib/names-net.c +++ b/lib/names-net.c @@ -21,6 +21,7 @@ char *pci_id_net_lookup(struct pci_access *a, int cat, int id1, int id2, int id3, int id4) { + static int resolver_inited; char name[256], dnsname[256], txt[256], *domain; byte answer[4096]; const byte *data; @@ -61,7 +62,11 @@ char sprintf(dnsname, "%s.%s", name, domain); a->debug("Resolving %s\n", dnsname); - res_init(); + if (!resolver_inited) + { + resolver_inited = 1; + res_init(); + } res = res_query(dnsname, ns_c_in, ns_t_txt, answer, sizeof(answer)); if (res < 0) { -- 2.39.5