summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2016-01-06 15:35:08 +0100
committerPeter Palfrader <peter@palfrader.org>2016-01-06 15:35:08 +0100
commit4654fd62f4e8ed6f8d9783f465f04ae18b68d4e5 (patch)
tree19fb88ae654b1f1008e70aa2de33cc6972c428ac
parentb013043031d4b51b3bca29ea8d386f688164e435 (diff)
Do not divide by zero
-rwxr-xr-xbin/ftpsync6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index ad53598..385aa92 100755
--- a/bin/ftpsync
+++ b/bin/ftpsync
@@ -211,8 +211,10 @@ tracefile() {
done
echo "Total bytes received in rsync: ${total}"
echo "Total time spent in rsync: ${STATS_TOTAL_RSYNC_TIME}"
- rate=$(( total / STATS_TOTAL_RSYNC_TIME ))
- echo "Average rate: ${rate} B/s"
+ if [[ 0 != ${STATS_TOTAL_RSYNC_TIME} ]]; then
+ rate=$(( total / STATS_TOTAL_RSYNC_TIME ))
+ echo "Average rate: ${rate} B/s"
+ fi
fi # full trace
fi # other traces
} > "${TRACEFILE}.new"