aboutsummaryrefslogtreecommitdiffstatshomepage
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
parentdarwin: allow for gnu mktemp in path (diff)
downloadpassword-store-5b95e618f38197b02ffccc3182c6b3b7fd482caf.tar.xz
password-store-5b95e618f38197b02ffccc3182c6b3b7fd482caf.zip
edit: bsd mktemp needs nothing after the Xs
-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