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

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

Updated eglibc fetch script.

  • Property mode set to 100644
File size: 967 bytes
  • libc/resolv/res_libc.c

    if /etc/resolv.conf is updated, then make sure applications
    already running get the updated information.
    
    http://bugs.gentoo.org/177416
    
     
    2222#include <arpa/nameser.h>
    2323#include <resolv.h>
    2424#include <bits/libc-lock.h>
     25#include <sys/stat.h>
    2526
    2627
    2728/* The following bit is copied from res_data.c (where it is #ifdef'ed
     
    101102__res_maybe_init (res_state resp, int preinit)
    102103{
    103104        if (resp->options & RES_INIT) {
     105                static time_t last_mtime, last_check;
     106                time_t now;
     107                struct stat statbuf;
     108               
     109                time (&now);
     110                if (now != last_check) {
     111                        last_check = now;
     112                        if (stat (_PATH_RESCONF, &statbuf) == 0 && last_mtime != statbuf.st_mtime) {
     113                                last_mtime = statbuf.st_mtime;
     114                                atomicinclock (lock);
     115                                atomicinc (__res_initstamp);
     116                                atomicincunlock (lock);
     117                        }
     118                }
    104119                if (__res_initstamp != resp->_u._ext.initstamp) {
    105120                        if (resp->nscount > 0) {
    106121                                __res_nclose (resp);
Note: See TracBrowser for help on using the repository browser.