📄 10
字号:
Received: from copland.udel.edu by huey.udel.edu id aa04014; 4 Jul 96 7:35 EDTReceived: from ren.ee.lbl.gov (ren.ee.lbl.gov [131.243.1.52]) by copland.udel.edu (8.7.5/8.7.3) with ESMTP id HAA12971 for <mills@udel.edu>; Thu, 4 Jul 1996 07:35:04 -0400 (EDT)Received: by ren.ee.lbl.gov (8.7.1/1.43r) id EAA01080; Thu, 4 Jul 1996 04:35:02 -0700 (PDT)Message-Id: <199607041135.EAA01080@ren.ee.lbl.gov>To: Dave Mills <mills@udel.edu>Subject: xntp 3.5f bug reportDate: Thu, 04 Jul 96 04:35:01 PDTFrom: Craig Leres <leres@ee.lbl.gov>If you feed xntpd an empty ntp.drift file (an obvious thing to do wheninstalling it on a new system), it syslog's some garbage: Jul 4 03:43:53 bat xntpd[237]: drift value o^?wpow^Dl invalidThis is because fscanf() returns EOF (aka -1) on end of file. Sincewhat we're really doing is reading a string, my fix uses fgets().(Besides, I hate fscanf(); you're never quite sure how much of theinput it actually reads.)It also seemed like a bug that loop_config() is not called if the driftfile contains garbage. In my case, the first bug was keeping the kernelpll code from kicking in. My version always calls loop_config().Context diff appended.Happy 4th. Craig------RCS file: RCS/ntp_util.c,vretrieving revision 1.1diff -c -r1.1 ntp_util.c*** /tmp/,RCSt1a15272 Thu Jul 4 04:30:09 1996--- ntp_util.c Thu Jul 4 04:30:03 1996****************** 276,296 **** if (errno != ENOENT) syslog(LOG_ERR, "can't open %s: %m", stats_drift_file);! loop_config(LOOP_DRIFTCOMP, &old_drift);! break;! }! ! if (fscanf(fp, "%s", buf) == 0) {! syslog(LOG_ERR, "can't read %s: %m",! stats_drift_file); (void) fclose(fp);- loop_config(LOOP_DRIFTCOMP, &old_drift);- break;- }- (void) fclose(fp);- if (!atolfp(buf, &old_drift)) {- syslog(LOG_ERR, "drift value %s invalid", buf);- break; } loop_config(LOOP_DRIFTCOMP, &old_drift); break;--- 276,290 ---- if (errno != ENOENT) syslog(LOG_ERR, "can't open %s: %m", stats_drift_file);! } else {! errno = 0;! if (fgets(buf, sizeof(buf), fp) == NULL) {! if (errno != 0)! syslog(LOG_ERR, "can't read %s: %m",! stats_drift_file);! } else if (!atolfp(buf, &old_drift))! syslog(LOG_ERR, "drift value %s invalid", buf); (void) fclose(fp); } loop_config(LOOP_DRIFTCOMP, &old_drift); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -