@@ -18,7 +18,7 @@
#include <netdb.h>
#include <string.h>
-
+#include <resolv/res_hconf.h>
#define LOOKUP_TYPE struct hostent
#define FUNCTION_NAME gethostbyaddr
@@ -27,7 +27,6 @@
#define ADD_VARIABLES addr, len, type
#define NEED_H_ERRNO 1
#define NEED__RES 1
-#define NEED__RES_HCONF 1
/* If the addr parameter is the IPv6 unspecified address no query must
be performed. */
#define PREPROCESS \
@@ -22,7 +22,7 @@
#include <string.h>
#include <arpa/inet.h>
#include <netinet/in.h>
-
+#include <resolv/res_hconf.h>
#define LOOKUP_TYPE struct hostent
#define FUNCTION_NAME gethostbyname2
@@ -30,7 +30,7 @@
#define ADD_PARAMS const char *name, int af
#define ADD_VARIABLES name, af
#define NEED_H_ERRNO 1
-#define NEED__RES_HCONF 1
+#define NEED__RES 1
#define POSTPROCESS \
if (status == NSS_STATUS_SUCCESS) \
_res_hconf_reorder_addrs (resbuf);
@@ -22,7 +22,7 @@
#include <string.h>
#include <arpa/inet.h>
#include <netinet/in.h>
-
+#include <resolv/res_hconf.h>
#define LOOKUP_TYPE struct hostent
#define FUNCTION_NAME gethostbyname
@@ -30,7 +30,7 @@
#define ADD_PARAMS const char *name
#define ADD_VARIABLES name
#define NEED_H_ERRNO 1
-#define NEED__RES_HCONF 1
+#define NEED__RES 1
#define POSTPROCESS \
if (status == NSS_STATUS_SUCCESS) \
_res_hconf_reorder_addrs (resbuf);
@@ -26,7 +26,6 @@
#include <unistd.h>
#include <sys/mman.h>
#include <resolv/resolv-internal.h>
-#include <resolv/res_hconf.h>
#include "dbg_log.h"
#include "nscd.h"
@@ -102,7 +101,6 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
nip = hosts_database;
/* Initialize configurations. */
- _res_hconf_init ();
if (__res_maybe_init (&_res, 0) == -1)
no_more = 1;
@@ -28,7 +28,6 @@
#define EXTRA_VARIABLES , ttlp
#define NEED_H_ERRNO 1
#define NEED__RES 1
-#define NEED__RES_HCONF 1
/* We are nscd, so we don't want to be talking to ourselves. */
#undef USE_NSCD
@@ -32,7 +32,7 @@
#define ADD_VARIABLES name, af
#define EXTRA_VARIABLES , ttlp, canonp
#define NEED_H_ERRNO 1
-#define NEED__RES_HCONF 1
+#define NEED__RES 1
#define HANDLE_DIGITS_DOTS 1
#define HAVE_LOOKUP_BUFFER 1
@@ -25,9 +25,6 @@
#ifdef USE_NSCD
# include <nscd/nscd_proto.h>
#endif
-#ifdef NEED__RES_HCONF
-# include <resolv/res_hconf.h>
-#endif
#ifdef NEED__RES
# include <resolv.h>
#endif
@@ -273,9 +270,6 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
return errno;
}
#endif /* need _res */
-#ifdef NEED__RES_HCONF
- _res_hconf_init ();
-#endif /* need _res_hconf */
void *tmp_ptr = fct.l;
#ifdef PTR_MANGLE
@@ -46,7 +46,7 @@ struct hconf
};
extern struct hconf _res_hconf;
-extern void _res_hconf_init (void);
+extern void _res_hconf_init (void) attribute_hidden;
extern void _res_hconf_trim_domain (char *domain);
extern void _res_hconf_trim_domains (struct hostent *hp);
extern void _res_hconf_reorder_addrs (struct hostent *hp);
@@ -85,6 +85,7 @@
#include <ctype.h>
#include <netdb.h>
#include <resolv/resolv-internal.h>
+#include <res_hconf.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
@@ -430,6 +431,9 @@ res_vinit_1 (res_state statp, bool preinit, FILE *fp, char **buffer)
int
__res_vinit (res_state statp, int preinit)
{
+ /* Ensure that /etc/hosts.conf has been loaded (once). */
+ _res_hconf_init ();
+
FILE *fp = fopen (_PATH_RESCONF, "rce");
if (fp == NULL)
switch (errno)
@@ -80,7 +80,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <not-cancel.h>
#include <nscd/nscd-client.h>
#include <nscd/nscd_proto.h>
-#include <resolv/res_hconf.h>
#include <scratch_buffer.h>
#include <inet/net-internal.h>
@@ -767,7 +766,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
nip = __nss_hosts_database;
/* Initialize configurations. */
- _res_hconf_init ();
if (__res_maybe_init (&_res, 0) == -1)
no_more = 1;