From: Martin Mares Date: Wed, 13 Feb 2008 15:57:02 +0000 (+0100) Subject: Call res_init() only once. X-Git-Tag: v3.0.0~1^2~27 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a14d7f993829bbc538d76b18f8935e67cffa3bfe;p=pciutils.git Call res_init() only once. This avoids perpetual re-reading of /etc/resolv.conf. --- 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) {