diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-06-30 14:44:04 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-06-30 14:44:04 +0200 |
commit | 78a56a4d7b7d74ded10436f9d1e972cc47807cab (patch) | |
tree | 0ab4114086c62c425f3cbe21273e83752a5bf13d /src | |
parent | 326a12c9bf8f8b8a703c8a518c035f547524e01e (diff) | |
download | pass-78a56a4d7b7d74ded10436f9d1e972cc47807cab.tar.gz pass-78a56a4d7b7d74ded10436f9d1e972cc47807cab.tar.bz2 pass-78a56a4d7b7d74ded10436f9d1e972cc47807cab.zip |
tmpdir: more cross platform solution, and .txt file ending
Diffstat (limited to '')
-rwxr-xr-x | src/password-store.sh | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/password-store.sh b/src/password-store.sh index 575371a..38dce6c 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -168,7 +168,7 @@ tmpdir() { [[ $1 == "nowarn" ]] && warn=0 local template="$PROGRAM.XXXXXXXXXXXXX" if [[ -d /dev/shm && -w /dev/shm && -x /dev/shm ]]; then - SECURE_TMPDIR="$(TMPDIR=/dev/shm mktemp -d -t "$template")" + SECURE_TMPDIR="$(mktemp -d "/dev/shm/$template")" remove_tmpfile() { rm -rf "$SECURE_TMPDIR" } @@ -182,7 +182,7 @@ tmpdir() { Are you sure you would like to continue? _EOF )" - SECURE_TMPDIR="$(mktemp -d -t "$template")" + SECURE_TMPDIR="$(mktemp -d "${TMPDIR:-/tmp}/$template")" shred_tmpfile() { find "$SECURE_TMPDIR" -type f -exec $SHRED {} + rm -rf "$SECURE_TMPDIR" @@ -419,10 +419,9 @@ cmd_edit() { mkdir -p -v "$PREFIX/$(dirname "$path")" set_gpg_recipients "$(dirname "$path")" local passfile="$PREFIX/$path.gpg" - local template="$PROGRAM.XXXXXXXXXXXXX" tmpdir #Defines $SECURE_TMPDIR - local tmp_file="$(TMPDIR="$SECURE_TMPDIR" mktemp -t "$template")" + local tmp_file="$(mktemp "$SECURE_TMPDIR/XXXXXXXXXXXXX.txt")" local action="Add" |