On Thu, Dec 04, 2008 at 06:03:32PM -0800, Anirban Sinha wrote: > Hi: > > I am sort of digging my way through the OpenNTPD codebase for my work. I > think I find a bug in the code. Please help me to understand the reason > if this is not a bug. > > In function ntp_main() (ntp.c), we poll() to check if there are any > events of interest. We do this: > > 1. Check internal fds (PIPE_MAIN) > 2. Then check PIPE_DNS fds > 3. Then check PIPE_HOTPLUG fds > > Next, for the server, we check all the fds we are listening on. And then > finally, for nfs clients, we check the fds for the remote servers. Now, > there's the issue in this line; > > for (j = 1; nfds > 0 && j < idx_peers; j++) { > ... > } > > Shouldn't the index start with 3? That is, shouldn't we do this: > > for (j = 3; nfds > 0 && j < idx_peers; j++) > > since, indices 0,1 and 2 correspond to the three checks I have written > above which are already done. > > In other words, can we apply the following patch to fix the issue? >
Yes, that seems like this bit was forgotten when PFD_MAX was "introduced" in 1.68 of ntp.c. Your fix is correct and commited. thanks for the report -- :wq Claudio