summaryrefslogtreecommitdiff
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
parentf9cfc1e96e2a2f0562aac7c07a5f11ebf66ca9ae (diff)
downloadpass-8253fe2a2caed31c245be285d196ebd56590c5c3.tar.gz
pass-8253fe2a2caed31c245be285d196ebd56590c5c3.tar.bz2
pass-8253fe2a2caed31c245be285d196ebd56590c5c3.zip
edit: pass local variable to trap function
Diffstat (limited to '')
-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