[git commit master] ntpd: fix vda's breakage

Denys Vlasenko vda.linux at googlemail.com
Tue Nov 24 13:43:20 UTC 2009


commit: http://git.busybox.net/busybox/commit/?id=9cc60d7e6b21e659a07042e46b9cd88f498fc8c0
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/ntpd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/networking/ntpd.c b/networking/ntpd.c
index fb82fd3..086b3ea 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -408,7 +408,7 @@ adjtime_wrap(void)
 	qsort(peers, offset_cnt, sizeof(peers[0]), offset_compare);
 
 	middle = offset_cnt / 2;
-	if ((offset_cnt & 1) == 0) {
+	if ((offset_cnt & 1) == 0 && middle != 0) {
 		offset_median = (peers[middle-1]->update.offset + peers[middle]->update.offset) / 2;
 		G.status.rootdelay = (peers[middle-1]->update.delay + peers[middle]->update.delay) / 2;
 		G.status.stratum = MAX(peers[middle-1]->update.status.stratum, peers[middle]->update.status.stratum);
-- 
1.6.3.3



More information about the busybox-cvs mailing list