source: scripts/fetch/eglibc/2.10.1/35-dynamic_resolv.patch@ cd92167

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since cd92167 was b17b911f, checked in by jim <clfs@…>, 15 years ago

Updated eglibc fetch script.

  • Property mode set to 100644
File size: 967 bytes
RevLine 
[b17b911f]1if /etc/resolv.conf is updated, then make sure applications
2already running get the updated information.
3
4http://bugs.gentoo.org/177416
5
6--- libc/resolv/res_libc.c
7+++ libc/resolv/res_libc.c
8@@ -22,6 +22,7 @@
9 #include <arpa/nameser.h>
10 #include <resolv.h>
11 #include <bits/libc-lock.h>
12+#include <sys/stat.h>
13
14
15 /* The following bit is copied from res_data.c (where it is #ifdef'ed
16@@ -101,6 +102,20 @@
17 __res_maybe_init (res_state resp, int preinit)
18 {
19 if (resp->options & RES_INIT) {
20+ static time_t last_mtime, last_check;
21+ time_t now;
22+ struct stat statbuf;
23+
24+ time (&now);
25+ if (now != last_check) {
26+ last_check = now;
27+ if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
28+ last_mtime = statbuf.st_mtime;
29+ atomicinclock (lock);
30+ atomicinc (__res_initstamp);
31+ atomicincunlock (lock);
32+ }
33+ }
34 if (__res_initstamp != resp->_u._ext.initstamp) {
35 if (resp->nscount > 0) {
36 __res_nclose (resp);
37
Note: See TracBrowser for help on using the repository browser.