aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-29 05:46:52 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-29 05:46:52 +0200
commit8253fe2a2caed31c245be285d196ebd56590c5c3 (patch)
tree7faf8dab6f6dd805dbb79dd867315714d61171a2
parentMakefile: still needs posix shell (diff)
downloadpassword-store-8253fe2a2caed31c245be285d196ebd56590c5c3.tar.xz
password-store-8253fe2a2caed31c245be285d196ebd56590c5c3.zip
edit: pass local variable to trap function
-rwxr-xr-xsrc/password-store.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 6c89c2f..ad22833 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -407,10 +407,14 @@ cmd_edit() {
local passfile="$PREFIX/$path.gpg"
local template="$PROGRAM.XXXXXXXXXXXXX"
- trap '$SHRED "$tmp_file"; rm -rf "$SECURE_TMPDIR" "$tmp_file"' INT TERM EXIT
-
tmpdir #Defines $SECURE_TMPDIR
local tmp_file="$(TMPDIR="$SECURE_TMPDIR" mktemp -t "$template")"
+ eval "shred_tmpfile() {
+ $SHRED '$tmp_file'
+ rm -rf '$SECURE_TMPDIR' '$tmp_file'
+ }"
+ trap shred_tmpfile INT TERM EXIT
+
local action="Add"
if [[ -f $passfile ]]; then