From 12cf4d4a0c9e518e6941f34b55f3e69d6f58f6f1 Mon Sep 17 00:00:00 2001 From: cperciva Date: Thu, 14 Nov 2013 09:22:32 +0000 Subject: When verifying that files we need are present, also check that they don't have zero length. Filesystem corruption will tend to truncate files, and since these are short that's likely to result in them becoming empty. Suggested by: Richard Clayton Convinced by: rwatson MFC after: 3 weeks --- usr.sbin/portsnap/portsnap/portsnap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.sbin/portsnap') diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh index 1cc2da8..81efbb7 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.sh +++ b/usr.sbin/portsnap/portsnap/portsnap.sh @@ -952,7 +952,7 @@ extract_run() { cat ${WORKDIR}/INDEX fi | while read FILE HASH; do echo ${PORTSDIR}/${FILE} - if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then + if ! [ -s "${WORKDIR}/files/${HASH}.gz" ]; then echo "files/${HASH}.gz not found -- snapshot corrupt." return 1 fi @@ -996,7 +996,7 @@ update_run_extract() { comm -13 ${PORTSDIR}/.portsnap.INDEX - | while read FILE HASH; do echo ${PORTSDIR}/${FILE} - if ! [ -r "${WORKDIR}/files/${HASH}.gz" ]; then + if ! [ -s "${WORKDIR}/files/${HASH}.gz" ]; then echo "files/${HASH}.gz not found -- snapshot corrupt." return 1 fi -- cgit v1.1