Movatterモバイル変換
[0]ホーム
This is the mail archive of thelibc-alpha@sourceware.orgmailing list for theglibc project.
[PATCH] resolv/resolv.h: allow alternative resolv.conf files
- From: Renzo Davoli <renzo at cs dot unibo dot it>
- To: libc-alpha at sourceware dot org
- Date: Thu, 17 Aug 2017 13:50:13 +0200
- Subject: [PATCH] resolv/resolv.h: allow alternative resolv.conf files
- Authentication-results: sourceware.org; auth=none
In network namespaces (like vdenshttps://github.com/rd235/vdens) it is sometimes necessary todefine per-namespace resolver configurations.The simple patch here attached permits the definition of an environment variabile to define thepath of the file to use instead of /etc/resolv.conf.e.g.:export PATH_RESCONF=/tmp/resolv.conf2017-08-17 Renzo Davoli <renzo@cs.unibo.it>diff --git a/resolv/resolv.h b/resolv/resolv.hindex e8c581ccd1..5e7a8143c3 100644--- a/resolv/resolv.h+++ b/resolv/resolv.h@@ -91,7 +91,10 @@ */ #ifndef _PATH_RESCONF-#define _PATH_RESCONF "/etc/resolv.conf"+#define _PATH_RESCONF ({ \+char *path_resconf = getenv("PATH_RESCONF"); \+path_resconf ? path_resconf : "/etc/resolv.conf"; \+}) #endif struct res_sym {
[8]ページ先頭