| 22 |
#include <arpa/nameser.h> |
#include <arpa/nameser.h> |
| 23 |
#include <resolv.h> |
#include <resolv.h> |
| 24 |
#include <bits/libc-lock.h> |
#include <bits/libc-lock.h> |
| 25 |
|
#include <sys/stat.h> |
| 26 |
|
|
| 27 |
/* The following bit is copied from res_data.c (where it is #ifdef'ed |
/* The following bit is copied from res_data.c (where it is #ifdef'ed |
| 28 |
out) since res_init() should go into libc.so but the rest of that |
out) since res_init() should go into libc.so but the rest of that |
| 94 |
int |
int |
| 95 |
__res_maybe_init (res_state resp, int preinit) |
__res_maybe_init (res_state resp, int preinit) |
| 96 |
{ |
{ |
| 97 |
|
static time_t last_mtime; |
| 98 |
|
struct stat statbuf; |
| 99 |
|
int ret; |
| 100 |
|
|
| 101 |
if (resp->options & RES_INIT) { |
if (resp->options & RES_INIT) { |
| 102 |
if (__res_initstamp != resp->_u._ext.initstamp) { |
ret = stat (_PATH_RESCONF, &statbuf); |
| 103 |
|
if ((__res_initstamp != resp->_u._ext.initstamp) |
| 104 |
|
|| ((ret == 0) && (last_mtime != statbuf.st_mtime))) { |
| 105 |
|
if (ret == 0) |
| 106 |
|
last_mtime = statbuf.st_mtime; |
| 107 |
if (resp->nscount > 0) |
if (resp->nscount > 0) |
| 108 |
__res_iclose (resp, true); |
__res_iclose (resp, true); |
| 109 |
return __res_vinit (resp, 1); |
return __res_vinit (resp, 1); |