yann@1625: ripped from SuSE yann@1625: yann@1625: if /etc/resolv.conf is updated, then make sure applications yann@1625: already running get the updated information. yann@1625: yann@1625: http://bugs.gentoo.org/177416 yann@1625: yann@1625: diff -durN glibc-2.10.1.orig/resolv/res_libc.c glibc-2.10.1/resolv/res_libc.c yann@1625: --- glibc-2.10.1.orig/resolv/res_libc.c 2009-02-07 05:27:42.000000000 +0100 yann@1625: +++ glibc-2.10.1/resolv/res_libc.c 2009-11-13 00:49:59.000000000 +0100 yann@1625: @@ -22,6 +22,7 @@ yann@1625: #include yann@1625: #include yann@1625: #include yann@1625: +#include yann@1625: yann@1625: yann@1625: /* The following bit is copied from res_data.c (where it is #ifdef'ed yann@1625: @@ -95,6 +96,20 @@ yann@1625: __res_maybe_init (res_state resp, int preinit) yann@1625: { yann@1625: if (resp->options & RES_INIT) { yann@1625: + static time_t last_mtime, last_check; yann@1625: + time_t now; yann@1625: + struct stat statbuf; yann@1625: + yann@1625: + time (&now); yann@1625: + if (now != last_check) { yann@1625: + last_check = now; yann@1625: + if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) { yann@1625: + last_mtime = statbuf.st_mtime; yann@1625: + atomicinclock (lock); yann@1625: + atomicinc (__res_initstamp); yann@1625: + atomicincunlock (lock); yann@1625: + } yann@1625: + } yann@1625: if (__res_initstamp != resp->_u._ext.initstamp) { yann@1625: if (resp->nscount > 0) yann@1625: __res_iclose (resp, true);