diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-24 14:43:20 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-11-24 14:43:20 +0100 |
commit | 9cc60d7e6b21e659a07042e46b9cd88f498fc8c0 (patch) | |
tree | 7256bac972a793a6c19fd94989d878474290019e /networking/ntpd.c | |
parent | f42fa1b21e2ef5275c3d044bb16c5b1c6d966b6f (diff) | |
download | busybox-w32-9cc60d7e6b21e659a07042e46b9cd88f498fc8c0.tar.gz busybox-w32-9cc60d7e6b21e659a07042e46b9cd88f498fc8c0.tar.bz2 busybox-w32-9cc60d7e6b21e659a07042e46b9cd88f498fc8c0.zip |
ntpd: fix vda's breakage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ntpd.c')
-rw-r--r-- | networking/ntpd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c index fb82fd309..086b3ea74 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
@@ -408,7 +408,7 @@ adjtime_wrap(void) | |||
408 | qsort(peers, offset_cnt, sizeof(peers[0]), offset_compare); | 408 | qsort(peers, offset_cnt, sizeof(peers[0]), offset_compare); |
409 | 409 | ||
410 | middle = offset_cnt / 2; | 410 | middle = offset_cnt / 2; |
411 | if ((offset_cnt & 1) == 0) { | 411 | if ((offset_cnt & 1) == 0 && middle != 0) { |
412 | offset_median = (peers[middle-1]->update.offset + peers[middle]->update.offset) / 2; | 412 | offset_median = (peers[middle-1]->update.offset + peers[middle]->update.offset) / 2; |
413 | G.status.rootdelay = (peers[middle-1]->update.delay + peers[middle]->update.delay) / 2; | 413 | G.status.rootdelay = (peers[middle-1]->update.delay + peers[middle]->update.delay) / 2; |
414 | G.status.stratum = MAX(peers[middle-1]->update.status.stratum, peers[middle]->update.status.stratum); | 414 | G.status.stratum = MAX(peers[middle-1]->update.status.stratum, peers[middle]->update.status.stratum); |