diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-03-27 22:54:14 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-03-27 22:54:14 +0100 |
commit | acce32db93d914d6e9d94d0b28a246a7d57e2253 (patch) | |
tree | f354d2f1b74c492799e462874a1370395a6ea6ba /src | |
parent | 715c77a2e03d267f6697909b7943374c4d0e107f (diff) | |
download | wireshark-notes-acce32db93d914d6e9d94d0b28a246a7d57e2253.tar.gz |
sslkeylog.sh: allow it to be sourced
Switch to bash as there is no readable / easy way to make it compatible
for all shells in the world.
Diffstat (limited to 'src')
-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 ]] || \ "$@" |