summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/ntp.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-07-09 15:00:44 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-07-09 15:00:44 +0000
commit53ffc60a4372284765807b0beeb7d123c1a1b642 (patch)
treec9d0f385a7424e7354198afbca1d8c5921b7e4ef /usr.sbin/ntpd/ntp.c
parenteb95ccbf36d9da672b1750ba1a19e33d48c2881b (diff)
don't try to update the clock when we have no data
Diffstat (limited to 'usr.sbin/ntpd/ntp.c')
-rw-r--r--usr.sbin/ntpd/ntp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index 6bf01eac712..fe3ef683729 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.20 2004/07/09 12:21:09 henning Exp $ */
+/* $OpenBSD: ntp.c,v 1.21 2004/07/09 15:00:43 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -287,10 +287,11 @@ ntp_adjtime(struct ntpd_conf *conf)
offset_cnt++;
}
- offset_median /= offset_cnt;
-
- imsg_compose(&ibuf_main, IMSG_ADJTIME, 0,
+ if (offset_cnt > 0) {
+ offset_median /= offset_cnt;
+ imsg_compose(&ibuf_main, IMSG_ADJTIME, 0,
&offset_median, sizeof(offset_median));
+ }
}
int