svn commit: r310240 - stable/11/usr.sbin/portsnap/portsnap

Colin Percival cperciva at FreeBSD.org
Mon Dec 19 07:46:22 UTC 2016


Author: cperciva
Date: Mon Dec 19 07:46:20 2016
New Revision: 310240
URL: https://svnweb.freebsd.org/changeset/base/310240

Log:
  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.)

Modified:
  stable/11/usr.sbin/portsnap/portsnap/portsnap.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/portsnap/portsnap/portsnap.sh
==============================================================================
--- stable/11/usr.sbin/portsnap/portsnap/portsnap.sh	Mon Dec 19 07:40:45 2016	(r310239)
+++ stable/11/usr.sbin/portsnap/portsnap/portsnap.sh	Mon Dec 19 07:46:20 2016	(r310240)
@@ -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() {


More information about the svn-src-stable mailing list