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

call dirname $0 three fewer times by caching the unmodified value prior to readlink modifications

This commit is contained in:
Richard Soderberg 2015-09-03 06:40:48 -07:00
parent f002b3573a
commit 5ec3184a37

View File

@ -10,7 +10,8 @@
DOBENCHMARK=0 DOBENCHMARK=0
BENCHMARKITER=30 BENCHMARKITER=30
REALPATH=$(dirname "$0") DIRNAMEPATH=$(dirname "$0")
REALPATH="$DIRNAMEPATH"
# make sure this doesn't error out when readlink -f isn't available (OSX) # make sure this doesn't error out when readlink -f isn't available (OSX)
readlink -f "$0" &>/dev/null && REALPATH=$(dirname "$(readlink -f "$0")") readlink -f "$0" &>/dev/null && REALPATH=$(dirname "$(readlink -f "$0")")
OPENSSLBIN="${REALPATH}/openssl" OPENSSLBIN="${REALPATH}/openssl"
@ -43,8 +44,8 @@ if [[ "$TIMEOUTOUTPUT" =~ BusyBox ]]; then
fi fi
# use custom config file to enable GOST ciphers # use custom config file to enable GOST ciphers
if [[ -e $(dirname "$0")/openssl.cnf ]]; then if [[ -e $DIRNAMEPATH/openssl.cnf ]]; then
export OPENSSL_CONF="$(dirname "$0")/openssl.cnf" export OPENSSL_CONF="$DIRNAMEPATH/openssl.cnf"
fi fi
# find a list of trusted CAs on the local system, or use the provided list # find a list of trusted CAs on the local system, or use the provided list
@ -57,7 +58,7 @@ if [[ -z "$CACERTS" ]]; then
done done
fi fi
if [[ ! -e "$CACERTS" ]]; then if [[ ! -e "$CACERTS" ]]; then
CACERTS="$(dirname "$0")/ca-bundle.crt" CACERTS="$DIRNAMEPATH/ca-bundle.crt"
fi fi
# RSA ciphers are put at the end to force Google servers to accept ECDSA ciphers # RSA ciphers are put at the end to force Google servers to accept ECDSA ciphers