yann@1201: Original patch from: gentoo/src/patchsets/glibc/2.9/1055_all_glibc-resolv-dynamic.patch yann@1201: yann@1201: -= BEGIN original header =- yann@1201: ripped from SuSE yann@1201: yann@1201: if /etc/resolv.conf is updated, then make sure applications yann@1201: already running get the updated information. yann@1201: yann@1201: http://bugs.gentoo.org/177416 yann@1201: yann@1201: -= END original header =- yann@1201: yann@1201: diff -durN glibc-2_9.orig/resolv/res_libc.c glibc-2_9/resolv/res_libc.c yann@1201: --- glibc-2_9.orig/resolv/res_libc.c 2006-10-11 10:59:28.000000000 +0200 yann@1201: +++ glibc-2_9/resolv/res_libc.c 2009-02-02 22:00:57.000000000 +0100 yann@1201: @@ -22,6 +22,7 @@ yann@1201: #include yann@1201: #include yann@1201: #include yann@1201: +#include yann@1201: yann@1201: yann@1201: /* The following bit is copied from res_data.c (where it is #ifdef'ed yann@1201: @@ -95,6 +96,20 @@ yann@1201: __res_maybe_init (res_state resp, int preinit) yann@1201: { yann@1201: if (resp->options & RES_INIT) { yann@1201: + static time_t last_mtime, last_check; yann@1201: + time_t now; yann@1201: + struct stat statbuf; yann@1201: + yann@1201: + time (&now); yann@1201: + if (now != last_check) { yann@1201: + last_check = now; yann@1201: + if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) { yann@1201: + last_mtime = statbuf.st_mtime; yann@1201: + atomicinclock (lock); yann@1201: + atomicinc (__res_initstamp); yann@1201: + atomicincunlock (lock); yann@1201: + } yann@1201: + } yann@1201: if (__res_initstamp != resp->_u._ext.initstamp) { yann@1201: if (resp->nscount > 0) { yann@1201: __res_iclose (resp, true);