From 73fa7c5c52e921bca657739755c1ffc51914391d Mon Sep 17 00:00:00 2001 From: fenner Date: Tue, 12 Nov 2002 07:09:43 +0000 Subject: Don't divide by zero to calculate the ETA, even if we haven't gotten any data in 30 seconds. --- usr.bin/fetch/fetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'usr.bin/fetch/fetch.c') 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; -- cgit v1.1