libc/resolv: Export __res_conf_name

Add a new global variable, __res_conf_name, which is initialized to
_PATH_RESCONF and used in its place by res_init().  This allows test
programs (and applications) to select a different configuration file
to read instead of /etc/resolv.conf.

PR:		220610
This commit is contained in:
Dag-Erling Smørgrav committed 2026-06-29 13:49:20 +00:00
1 parent 672cb7320a
commit 702c24ccc0
2 files changed
+8 -1

No files matched your search

+4
View File
@@ -105,3 +105,7 @@ FBSD_1.0 {
FBSD_1.4 {
__res_nrandomid;
};
FBSD_1.9 {
__res_conf_name;
};
+4 -1
View File
@@ -116,6 +116,8 @@ static int res_setsortlist(res_state, int, const char *, const char *);
(strncmp((str), (word), (end) - (str)) == 0 && \
(word)[(end) - (str)] == '\0')
const char *__res_conf_name = _PATH_RESCONF;
/*
* Resolver state default settings.
*/
@@ -214,7 +216,8 @@ __res_vinit(res_state statp, int preinit)
res_setservers(statp, u, nitems(u));
/* read the configuration file */
res_readconf(statp, _PATH_RESCONF, maxns);
if (__res_conf_name != NULL)
res_readconf(statp, __res_conf_name, maxns);
/* Allow user to override the local domain definition */
if ((cp = secure_getenv("LOCALDOMAIN")) != NULL) {