math bug in cm_select_or_poll() ?

Chris Hecker checker at d6.com
Mon Jan 21 20:50:43 EST 2013


usecs is in microseconds

Chris


On 2013-01-21 16:27, Richard Silverman wrote:
> Hello,
>
> 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?
>
> (Also, unrelated typo: "anyone" should be "anyway," I assume.)
>
> Thanks,
>


More information about the krbdev mailing list