Browse Source

if the drift file is missing, reset adjfreq to zero; iirc diff from Glaser

from a long time ago. ok ckuethe@
OPENBSD_4_3
otto 17 years ago
parent
commit
40598298ed
1 changed files with 14 additions and 12 deletions
  1. +14
    -12
      src/usr.sbin/ntpd/ntpd.c

+ 14
- 12
src/usr.sbin/ntpd/ntpd.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.c,v 1.52 2007/09/13 20:34:12 jmc Exp $ */
/* $OpenBSD: ntpd.c,v 1.53 2007/11/22 10:22:30 otto Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -431,20 +431,22 @@ readfreq(void)
int64_t current; int64_t current;
double d; double d;
/* if we're adjusting frequency already, don't override */
if (adjfreq(NULL, &current) == -1) {
log_warn("adjfreq failed");
return;
}
if (current != 0)
return;
fp = fopen(DRIFTFILE, "r"); fp = fopen(DRIFTFILE, "r");
if (fp == NULL)
if (fp == NULL) {
/* if the drift file has been deleted by the user, reset */
current = 0;
if (adjfreq(&current, NULL) == -1)
log_warn("adjfreq reset failed");
return; return;
}
if (fscanf(fp, "%le", &d) == 1)
ntpd_adjfreq(d, 0);
/* if we're adjusting frequency already, don't override */
if (adjfreq(NULL, &current) == -1)
log_warn("adjfreq failed");
else if (current == 0) {
if (fscanf(fp, "%le", &d) == 1)
ntpd_adjfreq(d, 0);
}
fclose(fp); fclose(fp);
} }


Loading…
Cancel
Save