2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-11-22 22:33:40 +01:00

verify the results of pushd rather than trusting it

This commit is contained in:
Richard Soderberg 2015-09-02 21:57:24 -07:00
parent 81481cd016
commit 1c15af1ce3

View File

@ -281,8 +281,12 @@ c_hash() {
fi fi
if [[ ! -e $1/${h}.${num} ]]; then if [[ ! -e $1/${h}.${num} ]]; then
# file doesn't exist, create a link # file doesn't exist, create a link
pushd "$1" > /dev/null if pushd "$1" > /dev/null; then
ln -s "$2" "${h}.${num}" ln -s "$2" "${h}.${num}"
else
echo "'pushd $1' failed unexpectedly, refusing to proceed" 1>&2
exit 1
fi
popd > /dev/null popd > /dev/null
break break
fi fi