From 1c15af1ce32aaad7fb4d7a5cb842f421483f72cc Mon Sep 17 00:00:00 2001 From: Richard Soderberg Date: Wed, 2 Sep 2015 21:57:24 -0700 Subject: [PATCH] verify the results of pushd rather than trusting it --- cipherscan | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cipherscan b/cipherscan index e1dba57..64f6a85 100755 --- a/cipherscan +++ b/cipherscan @@ -281,8 +281,12 @@ c_hash() { fi if [[ ! -e $1/${h}.${num} ]]; then # file doesn't exist, create a link - pushd "$1" > /dev/null - ln -s "$2" "${h}.${num}" + if pushd "$1" > /dev/null; then + ln -s "$2" "${h}.${num}" + else + echo "'pushd $1' failed unexpectedly, refusing to proceed" 1>&2 + exit 1 + fi popd > /dev/null break fi