summaryrefslogtreecommitdiff
path: root/src/torrent.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-09 21:47:06 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-09 21:47:06 +0000
commitc0e12ac389135850dcd45ce108f5a6a0200ae03f (patch)
treee7ab9b938e2909f7a40d8fd34a476e301a511052 /src/torrent.c
parente1b13312f975f38d3d7437f28299912eff6947e0 (diff)
issue 174 - exec crash, issue 173 - files first update performance fixed.
Diffstat (limited to 'src/torrent.c')
-rw-r--r--src/torrent.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/torrent.c b/src/torrent.c
index 0c83995..fbc5884 100644
--- a/src/torrent.c
+++ b/src/torrent.c
@@ -610,7 +610,11 @@ gint64 peerfrom_get_lpd(JsonObject * pf)
gdouble file_get_progress(gint64 length, gint64 completed)
{
if (length > 0) {
- return ((gdouble) completed / (gdouble) length) * 100.0;
+ gdouble progress = ((gdouble) completed / (gdouble) length) * 100.0;
+ if (progress > 100.0)
+ return 100.0;
+ else
+ return progress;
} else {
return 0.0;
}