kirk@FSW348.JPL.NASA.GOV (Kirk Reinholtz) (06/10/91)
Heres the header of the file with the problem. static char *rcsid = "$Source: /usr/users/louie/ntp/RCS/ntpd.c,v $ $Revision: 3.4.1.9 $ $Date: 89/05/18 18:30:17 $"; #endif lint The error is that drift_comp has a undefined value if there is some problem with the /etc/ntp.drift file, like for example it has nothing in it because ntp wasn't up long enough to post anything. The fix is to set drift_comp to 0.0 in the "else" part of the validation check. Heres the code I ended up with: if ((fp = fopen(driftcomp_file, "r")) != NULL) { if (fscanf(fp, "%lf", &j) == 1 && j > -1.0 && j < 1.0) { drift_comp = j; } else { drift_comp = 0.0; fprintf(stderr, "init_ntp: bad drift compensation value\n"); syslog(LOG_ERR, "init_ntp: bad drift compensation value\n"); }; syslog(LOG_INFO, "Drift compensation value initialized to %f",drift_comp ); fclose(fp); } Enjoy!