Would you please check libntp/systime.c

Hal Murray hmurray at megapathdsl.net
Tue Jun 7 18:52:09 UTC 2016


The initial symptom is a warning from clang  3.8.0 on a Raspberry Pi.

../../libntp/systime.c:460:37: warning: variable 'tvlast' is uninitialized 
when
used here [-Wuninitialized]

Why didn't any of the other tools notice this?  The code isn't particularly 
complicated.

--------

A diff with current ntp classic is 329 lines.  Most of the changes look 
reasonablle.  It;s POSIXifying writing time steps for the accounting system.  
But the warning looks like a bug to me, and I can't figure out some of the 
other changes.

<       /* get the current time as l_fp (without fuzz) and as struct timespec 
*/
---
>       /* get the current time as l_fp (without fuzz) and as struct timeval */
415a432,433
>       tvlast.tv_sec = timets.tv_sec;
>       tvlast.tv_usec = (timets.tv_nsec + 500) / 1000;
Those lines got dropped.  That's where tvlast got setup.

501,502c596
<       tvlast = timetv;
<       return true;
---
>       return TRUE;

The assignment to tvlast doesn't make sense.  It's a local variable so goes 
away with the return.


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list