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