password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

commit f423a27d4da8a1b830e368d846880886470b22dd
parent 8774bb4ebbe2ef19a846b84d41de956a848800dc
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Tue, 11 Sep 2012 17:07:59 +0200

Use portable mktemp.

Only GNU systems have --tmpdir, so for other systems we use the TMPDIR
environment variable.

Reported-by: Alexis <surryhill@gmail.com>

Diffstat:
Msrc/password-store.sh | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/password-store.sh b/src/password-store.sh @@ -201,9 +201,10 @@ case "$command" in path="$1" mkdir -p -v "$PREFIX/$(dirname "$path")" passfile="$PREFIX/$path.gpg" + template="$program.XXXXXXXXXXXXX" if [ -d /dev/shm -a -w /dev/shm -a -x /dev/shm ]; then - tmp_dir="$(mktemp -d --tmpdir=/dev/shm)" + tmp_dir="$(TMPDIR=/dev/shm mktemp -t $template -d)" else echo "Your system does not have /dev/shm, which means that it may" echo "be difficult to entirely erase the temporary non-encrypted" @@ -213,9 +214,9 @@ case "$command" in if ! [[ $yesno == "y" || $yesno == "Y" ]]; then exit 1 fi - tmp_dir="$(mktemp -d)" + tmp_dir="$(mktemp -t $template -d)" fi - tmp_file="$(mktemp --tmpdir="$tmp_dir")" + tmp_file="$(TMPDIR="$tmp_dir" mktemp -t $template)" action="Added" if [[ -f $passfile ]]; then