m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-06-30 15:04:02 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-06-30 15:10:12 +0200
commit5b95e618f38197b02ffccc3182c6b3b7fd482caf (patch)
tree60afaa1483051fc95989bbfcf516b6007f5b4e12 /src
parent4e6a49ebff535fdf5a07890af661ba7a2be6588a (diff)
edit: bsd mktemp needs nothing after the Xs
Diffstat (limited to 'src')
-rwxr-xr-xsrc/password-store.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 38dce6c..295015b 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -421,7 +421,7 @@ cmd_edit() {
local passfile="$PREFIX/$path.gpg"
tmpdir #Defines $SECURE_TMPDIR
- local tmp_file="$(mktemp "$SECURE_TMPDIR/XXXXXXXXXXXXX.txt")"
+ local tmp_file="$(mktemp -u "$SECURE_TMPDIR/XXXXX")-${path//\//-}.txt"
local action="Add"
@@ -430,6 +430,7 @@ cmd_edit() {
action="Edit"
fi
${EDITOR:-vi} "$tmp_file"
+ [[ -f $tmp_file ]] || die "New password not saved."
while ! $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" "$tmp_file"; do
yesno "GPG encryption failed. Would you like to try again?"
done