1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/2.9/250-resolv-dynamic.patch Wed May 19 17:53:04 2010 +0200
1.3 @@ -0,0 +1,44 @@
1.4 +Original patch from: gentoo/src/patchsets/glibc/2.9/1055_all_glibc-resolv-dynamic.patch
1.5 +
1.6 +-= BEGIN original header =-
1.7 +ripped from SuSE
1.8 +
1.9 +if /etc/resolv.conf is updated, then make sure applications
1.10 +already running get the updated information.
1.11 +
1.12 +http://bugs.gentoo.org/177416
1.13 +
1.14 +-= END original header =-
1.15 +
1.16 +diff -durN glibc-2_9.orig/resolv/res_libc.c glibc-2_9/resolv/res_libc.c
1.17 +--- glibc-2_9.orig/resolv/res_libc.c 2006-10-11 10:59:28.000000000 +0200
1.18 ++++ glibc-2_9/resolv/res_libc.c 2009-02-02 22:00:57.000000000 +0100
1.19 +@@ -22,6 +22,7 @@
1.20 + #include <arpa/nameser.h>
1.21 + #include <resolv.h>
1.22 + #include <bits/libc-lock.h>
1.23 ++#include <sys/stat.h>
1.24 +
1.25 +
1.26 + /* The following bit is copied from res_data.c (where it is #ifdef'ed
1.27 +@@ -95,6 +96,20 @@
1.28 + __res_maybe_init (res_state resp, int preinit)
1.29 + {
1.30 + if (resp->options & RES_INIT) {
1.31 ++ static time_t last_mtime, last_check;
1.32 ++ time_t now;
1.33 ++ struct stat statbuf;
1.34 ++
1.35 ++ time (&now);
1.36 ++ if (now != last_check) {
1.37 ++ last_check = now;
1.38 ++ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
1.39 ++ last_mtime = statbuf.st_mtime;
1.40 ++ atomicinclock (lock);
1.41 ++ atomicinc (__res_initstamp);
1.42 ++ atomicincunlock (lock);
1.43 ++ }
1.44 ++ }
1.45 + if (__res_initstamp != resp->_u._ext.initstamp) {
1.46 + if (resp->nscount > 0) {
1.47 + __res_iclose (resp, true);