diff options
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 9 |
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 |