diff options
-rwxr-xr-x | src/sslkeylog.sh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sslkeylog.sh b/src/sslkeylog.sh index b5bac94..0197302 100755 --- a/src/sslkeylog.sh +++ b/src/sslkeylog.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Invokes the given command, displaying the pre-master secrets to stderr # (or to the file given by envvar SSLKEYLOGFILE). # @@ -15,8 +15,10 @@ gdb() { "$@" } -export LD_PRELOAD=$(dirname "$0")/libsslkeylog.so -export SSLKEYLOGFILE=${SSLKEYLOGFILE:-/dev/stderr} +LD_PRELOAD=$(readlink -f "${BASH_SOURCE[0]%/*}")/libsslkeylog.so +SSLKEYLOGFILE=${SSLKEYLOGFILE:-/dev/stderr} +export LD_PRELOAD SSLKEYLOGFILE -# Run the command +# Run the command (if not sourced) +[[ ${BASH_SOURCE[0]} != $0 ]] || \ "$@" |