]> git.pld-linux.org Git - packages/glibc.git/blob - 1055_all_glibc-resolv-dynamic.patch
- rel 2; branch diff updated
[packages/glibc.git] / 1055_all_glibc-resolv-dynamic.patch
1 ripped from SuSE
2
3 if /etc/resolv.conf is updated, then make sure applications
4 already running get the updated information.
5
6 http://bugs.gentoo.org/177416
7
8 --- libc/resolv/res_libc.c
9 +++ libc/resolv/res_libc.c
10 @@ -22,6 +22,7 @@
11  #include <arpa/nameser.h>
12  #include <resolv.h>
13  #include <libc-lock.h>
14 +#include <sys/stat.h>
15  
16  
17  /* The following bit is copied from res_data.c (where it is #ifdef'ed
18 @@ -101,6 +102,20 @@
19  __res_maybe_init (res_state resp, int preinit)
20  {
21         if (resp->options & RES_INIT) {
22 +               static time_t last_mtime, last_check;
23 +               time_t now;
24 +               struct stat statbuf;
25 +               
26 +               time (&now);
27 +               if (now != last_check) {
28 +                       last_check = now;
29 +                       if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
30 +                               last_mtime = statbuf.st_mtime;
31 +                               atomicinclock (lock);
32 +                               atomicinc (__res_initstamp);
33 +                               atomicincunlock (lock);
34 +                       }
35 +               }
36                 if (__res_initstamp != resp->_u._ext.initstamp) {
37                         if (resp->nscount > 0) {
38                                 __res_nclose (resp);
This page took 0.453244 seconds and 3 git commands to generate.