Author: jilles
Date: Tue Oct  4 22:28:06 2011
New Revision: 226028
URL: http://svn.freebsd.org/changeset/base/226028

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

Modified:
  head/usr.sbin/portsnap/portsnap/portsnap.sh

Modified: head/usr.sbin/portsnap/portsnap/portsnap.sh
==============================================================================
--- head/usr.sbin/portsnap/portsnap/portsnap.sh Tue Oct  4 22:23:00 2011        
(r226027)
+++ head/usr.sbin/portsnap/portsnap/portsnap.sh Tue Oct  4 22:28:06 2011        
(r226028)
@@ -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-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to