Hi All,

Well, I believe I have found another issue with the function poll_resolv().  
The variable last_change needs to be static.  Otherwise, the 
difftime(statbuf.st_mtime, last_change) always is a rather large number... the 
number of seconds since time 0 (the initialized value of last_change at the top 
of the function).  By making this variable static, the last_change truly 
becomes the elapsed time in seconds since the last change for /etc/resolv.conf. 
 The last_change variable really represents the timestamp of when 
reload_servers() was called last.

To see the issue, I added a my_syslog to log that a change is detected and what 
the time difference is:

     if (force || (statbuf.st_mtime != res->mtime))
            res->mtime = statbuf.st_mtime;

            if (difftime(statbuf.st_mtime, last_change) != 0.0)
             my_syslog(LOG_INFO, _("change detected for %s; time difference is 
                       res->name, difftime(statbuf.st_mtime, last_change));
             last_change = statbuf.st_mtime;
             latest = res;

Without the static for last_change variable, the time difference reported is 
rather large... number of seconds since epoch (0).
static time_t last_change = 0;

I added the static in the above statement at the top of the function.


__________________________________________________________________ Confidential 
This e-mail and any files transmitted with it are the property of Belkin 
International, Inc. and/or its affiliates, are confidential, and are intended 
solely for the use of the individual or entity to whom this e-mail is 
addressed. If you are not one of the named recipients or otherwise have reason 
to believe that you have received this e-mail in error, please notify the 
sender and delete this message immediately from your computer. Any other use, 
retention, dissemination, forwarding, printing or copying of this e-mail is 
strictly prohibited. Pour la version fran?aise: 
http://www.belkin.com/email-notice/French.html F?r die deutsche ?bersetzung: 
Dnsmasq-discuss mailing list

Reply via email to