[PATCH] Custom resolv.conf

Thorsten Kukuk kukuk@suse.de
Wed Sep 15 19:20:00 GMT 2004


On Wed, Sep 15, Petter Reinholdtsen wrote:

> [Thorsten Kukuk]
> > But patches for this exists.
> 
> URL?  Sounds like something I should try to get into Debian.

Attached.

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B
-------------- next part --------------
--- resolv/res_libc.c	6 Aug 2004 17:52:53 -0000	1.20
+++ resolv/res_libc.c	9 Aug 2004 15:14:47 -0000
@@ -22,7 +22,7 @@
 #include <arpa/nameser.h>
 #include <resolv.h>
 #include <bits/libc-lock.h>
-
+#include <sys/stat.h>
 
 /* The following bit is copied from res_data.c (where it is #ifdef'ed
    out) since res_init() should go into libc.so but the rest of that
@@ -100,8 +100,17 @@ res_init(void) {
 int
 __res_maybe_init (res_state resp, int preinit)
 {
-	if (resp->options & RES_INIT) {
-		if (__res_initstamp != resp->_u._ext.initstamp) {
+  static time_t last_mtime;
+  struct stat statbuf;
+  int ret;
+
+		
+  if (resp->options & RES_INIT) {
+	ret = stat (_PATH_RESCONF, &statbuf);
+		if (__res_initstamp != resp->_u._ext.initstamp
+		  || (ret == 0) && (last_mtime != statbuf.st_mtime))
+		  {
+		        last_mtime = statbuf.st_mtime;
 			if (resp->nscount > 0) {
 				__res_nclose (resp);
 				for (int ns = 0; ns < MAXNS; ns++) {



More information about the Libc-alpha mailing list