From f423a27d4da8a1b830e368d846880886470b22dd Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 11 Sep 2012 17:07:59 +0200 Subject: Use portable mktemp. Only GNU systems have --tmpdir, so for other systems we use the TMPDIR environment variable. Reported-by: Alexis --- src/password-store.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3