[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r9102 - in /trunk/libc: ChangeLog.eglibc resolv/res_libc.c
- To: commits@xxxxxxxxxx
- Subject: [commits] r9102 - in /trunk/libc: ChangeLog.eglibc resolv/res_libc.c
- From: joseph@xxxxxxxxxx
- Date: Sun, 18 Oct 2009 18:08:38 -0000
Author: joseph
Date: Sun Oct 18 11:08:37 2009
New Revision: 9102
Log:
2009-10-18 Michael Schroeder <mls@xxxxxxx>
* resolv/res_libc.c (__res_maybe_init): Re-initialize if
_PATH_RESCONF has been modified since last init.
Modified:
trunk/libc/ChangeLog.eglibc
trunk/libc/resolv/res_libc.c
Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Sun Oct 18 11:08:37 2009
@@ -1,3 +1,8 @@
+2009-10-18 Michael Schroeder <mls@xxxxxxx>
+
+ * resolv/res_libc.c (__res_maybe_init): Re-initialize if
+ _PATH_RESCONF has been modified since last init.
+
2009-09-03 Peter Seebach <peter.seebach@xxxxxxxxxxxxx>
* manual/Makefile (texis): Change to $(objpfx)texis. Use
Modified: trunk/libc/resolv/res_libc.c
==============================================================================
--- trunk/libc/resolv/res_libc.c (original)
+++ trunk/libc/resolv/res_libc.c Sun Oct 18 11:08:37 2009
@@ -22,7 +22,7 @@
#include <arpa/nameser.h>
#include <resolv.h>
#include <bits/libc-lock.h>
-
+#include <sys/stat.h>
/* The following bit is copied from res_data.c (where it is #ifdef'ed
out) since res_init() should go into libc.so but the rest of that
@@ -94,8 +94,16 @@
int
__res_maybe_init (res_state resp, int preinit)
{
+ static time_t last_mtime;
+ struct stat statbuf;
+ int ret;
+
if (resp->options & RES_INIT) {
- if (__res_initstamp != resp->_u._ext.initstamp) {
+ ret = stat (_PATH_RESCONF, &statbuf);
+ if ((__res_initstamp != resp->_u._ext.initstamp)
+ || ((ret == 0) && (last_mtime != statbuf.st_mtime))) {
+ if (ret == 0)
+ last_mtime = statbuf.st_mtime;
if (resp->nscount > 0)
__res_iclose (resp, true);
return __res_vinit (resp, 1);