[PATCH] Custom resolv.conf
Michal Svec
msvec@suse.cz
Wed Sep 15 11:30:00 GMT 2004
Hi!
The attached patch adds a possibility to define a custom resolv.conf with
a shell variable (RESOLV_CONF, pretty similar to RESOLV_HOST_CONF).
Regards
Michal
--
Michal Svec
msvec@suse.cz
-------------- next part --------------
--- glibc-2.3/resolv/res_init.c.orig 2004-08-18 13:33:37.000000000 +0200
+++ glibc-2.3/resolv/res_init.c 2004-09-10 13:21:46.000000000 +0200
@@ -88,6 +88,8 @@
#include <not-cancel.h>
+#define ENV_RESOLVCONF "RESOLV_CONF"
+
/* Options. Should all be left alone. */
#define RESOLVSORT
#define RFC1535
@@ -149,6 +151,7 @@
int
__res_vinit(res_state statp, int preinit) {
register FILE *fp;
+ const char *rconf_name;
register char *cp, **pp;
register int n;
char buf[BUFSIZ];
@@ -240,7 +243,11 @@
(line[sizeof(name) - 1] == ' ' || \
line[sizeof(name) - 1] == '\t'))
- if ((fp = fopen(_PATH_RESCONF, "rc")) != NULL) {
+ rconf_name = getenv (ENV_RESOLVCONF);
+ if (rconf_name == NULL)
+ rconf_name = _PATH_RESCONF;
+
+ if ((fp = fopen(rconf_name, "rc")) != NULL) {
/* No threads use this stream. */
__fsetlocking (fp, FSETLOCKING_BYCALLER);
/* read the config file */
--- glibc-2.3/ChangeLog.orig 2004-08-23 09:35:30.000000000 +0200
+++ glibc-2.3/ChangeLog 2004-09-10 13:25:57.000000000 +0200
@@ -0,0 +1,5 @@
+2004-09-10 Michal Svec <msvec@suse.cz>
+
+ * resolv/res_init.c: possibility to define a custom RESOLV_CONF via
+ environment variable (analogically to RESOLV_HOST_CONF)
+
More information about the Libc-alpha
mailing list