aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-21 12:23:53 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-21 12:23:53 +0000
commitaadc797225906ba02fab4e1ad29b484acd4751b3 (patch)
tree4d9b78ed462b1b702b198f880e1a8faee369198c
parent5c882bdfa3c5ed14a324316dbf0c8ab3a4f51261 (diff)
quickfix to avoid division by zero, possibly we should go over all of these
once and for all
-rw-r--r--lib/progress.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/progress.c b/lib/progress.c
index 01ed8ac37..a36def75c 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -362,7 +362,8 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* Figure out the estimated time of arrival for the upload */
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&
- (data->progress.ulspeed > 100)) {
+ (data->progress.ulspeed>0) &&
+ (data->progress.size_ul > 100) ) {
ulestimate = (long)(data->progress.size_ul / data->progress.ulspeed);
ulpercen = (long)(100*(data->progress.uploaded/100) /
(data->progress.size_ul/100) );
@@ -370,7 +371,8 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* ... and the download */
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) &&
- (data->progress.dlspeed > 100)) {
+ (data->progress.dlspeed>0) &&
+ (data->progress.size_dl>100)) {
dlestimate = (long)(data->progress.size_dl / data->progress.dlspeed);
dlpercen = (long)(100*(data->progress.downloaded/100) /
(data->progress.size_dl/100));