Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Dec 2016 07:46:20 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r310240 - stable/11/usr.sbin/portsnap/portsnap
Message-ID:  <201612190746.uBJ7kKoL037721@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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() {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612190746.uBJ7kKoL037721>