aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.d/ntpd
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2016-08-25 03:09:23 +0000
committerCy Schubert <cy@FreeBSD.org>2016-08-25 03:09:23 +0000
commit05174bd95ff8b32c0edbb6dd008eff6a89d06710 (patch)
tree85888f857f800bc0c14e506b3f3a15782d39ae29 /etc/rc.d/ntpd
parent1ac66dd31d3cb4b86d0b1d71761c5c63e364dfa8 (diff)
downloadsrc-05174bd95ff8b32c0edbb6dd008eff6a89d06710.tar.gz
src-05174bd95ff8b32c0edbb6dd008eff6a89d06710.zip
Make validation of the leap-seconds file unconditional.
MFC after: 1 day
Notes
Notes: svn path=/head/; revision=304782
Diffstat (limited to 'etc/rc.d/ntpd')
-rwxr-xr-xetc/rc.d/ntpd22
1 files changed, 15 insertions, 7 deletions
diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd
index 7f62bd4a3781..2cf519d9b5e4 100755
--- a/etc/rc.d/ntpd
+++ b/etc/rc.d/ntpd
@@ -29,6 +29,8 @@ ntpd_precmd()
rc_flags="-g $rc_flags"
fi
+ ntpd_valid_leapfile
+
if [ ! -f $ntp_db_leapfile ]; then
ntpd_fetch_leapfile
fi
@@ -78,6 +80,19 @@ get_ntp_leapfile_expiry() {
'^\([1-9][0-9]*\)$' \| 0
}
+ntpd_valid_leapfile() {
+ # Refresh working leapfile with an invalid hash due to
+ # FreeBSD id header. Ntpd will ignore leapfiles with a
+ # mismatch hash. The file must be the virgin file from
+ # the source.
+ if [ -f $ntp_db_leapfile ]; then
+ grep -q '\$FreeBSD.*\$' $ntp_db_leapfile &&
+ cp -p $ntp_src_leapfile $ntp_db_leapfile
+ else
+ cp -p $ntp_src_leapfile $ntp_db_leapfile
+ fi
+}
+
ntpd_fetch_leapfile() {
local ntp_tmp_leapfile rc verbose
@@ -87,13 +102,6 @@ ntpd_fetch_leapfile() {
verbose=:
fi
- # Refresh working leapfile with an invalid hash due to
- # FreeBSD id header. Ntpd will ignore leapfiles with a
- # mismatch hash. The file must be the virgin file from
- # the source.
- test -f $ntp_db_leapfile &&
- grep -q '\$FreeBSD.*\$' $ntp_db_leapfile &&
- cp -p $ntp_src_leapfile $ntp_db_leapfile
ntp_tmp_leapfile="/var/run/ntpd.leap-seconds.list"
ntp_ver_no_src=$(get_ntp_leapfile_ver $ntp_src_leapfile)