patches/glibc/ports-2.13/180-resolv-dynamic.patch
changeset 2438 2ba5655f6297
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/ports-2.13/180-resolv-dynamic.patch	Tue May 03 00:19:56 2011 +0200
     1.3 @@ -0,0 +1,39 @@
     1.4 +ripped from SuSE
     1.5 +
     1.6 +if /etc/resolv.conf is updated, then make sure applications
     1.7 +already running get the updated information.
     1.8 +
     1.9 +http://bugs.gentoo.org/177416
    1.10 +
    1.11 +diff -durN glibc-2.13.orig/resolv/res_libc.c glibc-2.13/resolv/res_libc.c
    1.12 +--- glibc-2.13.orig/resolv/res_libc.c	2009-02-07 05:27:42.000000000 +0100
    1.13 ++++ glibc-2.13/resolv/res_libc.c	2009-11-13 00:49:59.000000000 +0100
    1.14 +@@ -22,6 +22,7 @@
    1.15 + #include <arpa/nameser.h>
    1.16 + #include <resolv.h>
    1.17 + #include <bits/libc-lock.h>
    1.18 ++#include <sys/stat.h>
    1.19 + 
    1.20 + 
    1.21 + /* The following bit is copied from res_data.c (where it is #ifdef'ed
    1.22 +@@ -95,6 +96,20 @@
    1.23 + __res_maybe_init (res_state resp, int preinit)
    1.24 + {
    1.25 + 	if (resp->options & RES_INIT) {
    1.26 ++		static time_t last_mtime, last_check;
    1.27 ++		time_t now;
    1.28 ++		struct stat statbuf;
    1.29 ++		
    1.30 ++		time (&now);
    1.31 ++		if (now != last_check) {
    1.32 ++			last_check = now;
    1.33 ++			if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
    1.34 ++				last_mtime = statbuf.st_mtime;
    1.35 ++				atomicinclock (lock);
    1.36 ++				atomicinc (__res_initstamp);
    1.37 ++				atomicincunlock (lock);
    1.38 ++			}
    1.39 ++		}
    1.40 + 		if (__res_initstamp != resp->_u._ext.initstamp) {
    1.41 + 			if (resp->nscount > 0)
    1.42 + 				__res_iclose (resp, true);