summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2012-09-11 17:07:59 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2012-09-11 17:55:23 +0200
commitf423a27d4da8a1b830e368d846880886470b22dd (patch)
tree409fd30c4fab6b596bad6f4d55073dd8cfea6e5a /src
parent8774bb4ebbe2ef19a846b84d41de956a848800dc (diff)
downloadpass-f423a27d4da8a1b830e368d846880886470b22dd.tar.gz
pass-f423a27d4da8a1b830e368d846880886470b22dd.tar.bz2
pass-f423a27d4da8a1b830e368d846880886470b22dd.zip
Use portable mktemp.1.2.1
Only GNU systems have --tmpdir, so for other systems we use the TMPDIR environment variable. Reported-by: Alexis <surryhill@gmail.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/password-store.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 8ca8c42..b5b657f 100755
--- 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