diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-06-28 09:37:40 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-06-29 13:49:20 +0000 |
| commit | 702c24ccc0c208e9bc697e775abe47ff723e3012 (patch) | |
| tree | 2aeb6a806badcc95d115d2b828c72b8ce90fa840 | |
| parent | 672cb7320a2754788bddf5cd026721b6f70a0d30 (diff) | |
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
| -rw-r--r-- | lib/libc/resolv/Symbol.map | 4 | ||||
| -rw-r--r-- | lib/libc/resolv/res_init.c | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/libc/resolv/Symbol.map b/lib/libc/resolv/Symbol.map index 26daecbe2eff..c12d594a7e6b 100644 --- a/lib/libc/resolv/Symbol.map +++ b/lib/libc/resolv/Symbol.map @@ -105,3 +105,7 @@ FBSD_1.0 { FBSD_1.4 { __res_nrandomid; }; + +FBSD_1.9 { + __res_conf_name; +}; diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c index 64522ef8f562..7466193e7476 100644 --- a/lib/libc/resolv/res_init.c +++ b/lib/libc/resolv/res_init.c @@ -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) { |
