Author: jilles
Date: Thu Oct 13 21:41:54 2011
New Revision: 226352
URL: http://svn.freebsd.org/changeset/base/226352

Log:
  MFC r226028: portsnap: Detect error immediately if we can't fetch the
  snapshot metadata.
  
  Also add some quotes around command substitution where useful and possible.

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

Modified: stable/8/usr.sbin/portsnap/portsnap/portsnap.sh
==============================================================================
--- stable/8/usr.sbin/portsnap/portsnap/portsnap.sh     Thu Oct 13 20:36:43 
2011        (r226351)
+++ stable/8/usr.sbin/portsnap/portsnap/portsnap.sh     Thu Oct 13 21:41:54 
2011        (r226352)
@@ -536,9 +536,9 @@ fetch_metadata() {
        rm -f ${SNAPSHOTHASH} tINDEX.new
 
        echo ${NDEBUG} "Fetching snapshot metadata... "
-       fetch ${QUIETFLAG} http://${SERVERNAME}/t/${SNAPSHOTHASH}
+       fetch ${QUIETFLAG} http://${SERVERNAME}/t/${SNAPSHOTHASH} \
            2>${QUIETREDIR} || return
-       if [ `${SHA256} -q ${SNAPSHOTHASH}` != ${SNAPSHOTHASH} ]; then
+       if [ "`${SHA256} -q ${SNAPSHOTHASH}`" != ${SNAPSHOTHASH} ]; then
                echo "snapshot metadata corrupt."
                return 1
        fi
@@ -606,7 +606,7 @@ fetch_index_sanity() {
 # Verify a list of files
 fetch_snapshot_verify() {
        while read F; do
-               if [ `gunzip -c snap/${F} | ${SHA256} -q` != ${F} ]; then
+               if [ "`gunzip -c snap/${F} | ${SHA256} -q`" != ${F} ]; then
                        echo "snapshot corrupt."
                        return 1
                fi
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to