From 8253fe2a2caed31c245be285d196ebd56590c5c3 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 29 Apr 2014 05:46:52 +0200 Subject: edit: pass local variable to trap function --- src/password-store.sh | 8 ++++++-- 1 file 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 -- cgit v1.2.3