diff options
author | cperciva <cperciva@FreeBSD.org> | 2016-12-19 07:46:20 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2016-12-19 07:46:20 +0000 |
commit | a3156aa8a17cb7e0909ef146c0400b7d39f1b211 (patch) | |
tree | 094cfb4fa0161c14ae139a4a261c6ae3c2a49df5 /usr.sbin/portsnap | |
parent | 4fbf51c358b1495f53f9ca31c593f44ad6668d67 (diff) | |
download | FreeBSD-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.sh | 6 |
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() { |