[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patches] Track resolv.conf, avoid need for explicit res_init() or nscd in long-running applications



On Fri, 2 Oct 2009, Hans-Peter Nilsson wrote:

> @@ -100,8 +100,17 @@ res_init(void) {
>  int
>  __res_maybe_init (res_state resp, int preinit)
>  {
> -	if (resp->options & RES_INIT) {
> -		if (__res_initstamp != resp->_u._ext.initstamp) {
> +  static time_t last_mtime;
> +  struct stat statbuf;
> +  int ret;
> +
> +		
> +  if (resp->options & RES_INIT) {
> +	ret = stat (_PATH_RESCONF, &statbuf);
> +		if (__res_initstamp != resp->_u._ext.initstamp
> +		  || (ret == 0) && (last_mtime != statbuf.st_mtime))
> +		  {
> +		        last_mtime = statbuf.st_mtime;
>  			if (resp->nscount > 0) {
>  				__res_nclose (resp);
>  				for (int ns = 0; ns < MAXNS; ns++) {

This diff does not apply cleanly to current sources.  Could you send a 
version that does (and is tested still to have the desired effect)?

-- 
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx