summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2002-11-12 07:09:43 +0000
committerfenner <fenner@FreeBSD.org>2002-11-12 07:09:43 +0000
commit73fa7c5c52e921bca657739755c1ffc51914391d (patch)
treed31d290a1be1c555c2edce29cac831f6991963de /usr.bin/fetch
parentb3245bbb2f8b732ad8cdfec56a73d5498b05fc70 (diff)
downloadFreeBSD-src-73fa7c5c52e921bca657739755c1ffc51914391d.zip
FreeBSD-src-73fa7c5c52e921bca657739755c1ffc51914391d.tar.gz
Don't divide by zero to calculate the ETA, even if we haven't gotten
any data in 30 seconds.
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r--usr.bin/fetch/fetch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index f863ef5..1cccc3a 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -150,7 +150,7 @@ stat_display(struct xferstat *xs, int force)
fprintf(stderr, " (%lld bytes): %d%%", (long long)xs->size,
(int)((100.0 * xs->rcvd) / xs->size));
elapsed = xs->last.tv_sec - xs->start.tv_sec;
- if (elapsed > 30) {
+ if (elapsed > 30 && xs->rcvd > 0) {
long remaining;
remaining = ((xs->size * elapsed) / xs->rcvd) - elapsed;
OpenPOWER on IntegriCloud