summaryrefslogtreecommitdiffstats
path: root/usr.sbin/portsnap
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2016-12-19 07:46:20 +0000
committercperciva <cperciva@FreeBSD.org>2016-12-19 07:46:20 +0000
commita3156aa8a17cb7e0909ef146c0400b7d39f1b211 (patch)
tree094cfb4fa0161c14ae139a4a261c6ae3c2a49df5 /usr.sbin/portsnap
parent4fbf51c358b1495f53f9ca31c593f44ad6668d67 (diff)
downloadFreeBSD-src-a3156aa8a17cb7e0909ef146c0400b7d39f1b211.zip
FreeBSD-src-a3156aa8a17cb7e0909ef146c0400b7d39f1b211.tar.gz
MFC r310179:
Avoid division by zero in the rare case that portsnap needs to fetch zero patches. (This avoids two "dc: divide by zero" warnings.)
Diffstat (limited to 'usr.sbin/portsnap')
-rw-r--r--usr.sbin/portsnap/portsnap/portsnap.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh
index 0e16370..dd33ee3 100644
--- a/usr.sbin/portsnap/portsnap/portsnap.sh
+++ b/usr.sbin/portsnap/portsnap/portsnap.sh
@@ -619,8 +619,10 @@ fetch_progress() {
pct_fmt()
{
- printf " \r"
- printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc`
+ if [ $TOTAL -gt 0 ]; then
+ printf " \r"
+ printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc`
+ fi
}
fetch_progress_percent() {
OpenPOWER on IntegriCloud