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