math bug in cm_select_or_poll() ?
res at qoxp.net
Mon Jan 21 21:00:39 EST 2013
On Tue, 22 Jan 2013, Roland C. Dowdeswell wrote:
> On Mon, Jan 21, 2013 at 07:27:25PM -0500, Richard Silverman wrote:
>> In src/lib/krb5/os/sendto_kdc.c:cm_select_or_poll(), there is this code:
>> timeout = (in->end_time.tv_sec - now.tv_sec) * 1000 +
>> (in->end_time.tv_usec - now.tv_usec) / 1000;
>> /* We don't need a separate copy of the selstate for poll, but use one
>> * anyone for consistency with the select wrapper. */
>> *out = *in;
>> *sret = poll(out->fds, out->nfds, timeout);
>> Since the poll(2) timeout is in milliseconds, the intent appears to be to
>> compute the difference in milliseconds between end_time and now, by
>> scaling the seconds portion of the difference up to match the milliseconds
>> portion and adding them. Can someone explain what the "/ 1000" is for? It
>> looks wrong to me; am I missing something?
> tv_usec is microseconds, not milliseconds.
Oops! Of course. Stared at that for a while trying not to be wrong, but failed. Thanks. :)
More information about the krbdev