summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-03-27 22:54:14 +0100
committerPeter Wu <peter@lekensteyn.nl>2015-03-27 22:54:14 +0100
commitacce32db93d914d6e9d94d0b28a246a7d57e2253 (patch)
treef354d2f1b74c492799e462874a1370395a6ea6ba /src
parent715c77a2e03d267f6697909b7943374c4d0e107f (diff)
downloadwireshark-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-xsrc/sslkeylog.sh10
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 ]] || \
"$@"