wg-quick: freebsd: export TMPDIR when restoring and don't make empty

Otherwise mktemp doesn't see it, and if it's empty we wind up in /.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2019-03-18 14:41:10 -06:00
parent fc719b7d7e
commit 7c20ac5ce2
1 changed files with 2 additions and 1 deletions

View File

@ -42,8 +42,9 @@ unset ORIGINAL_TMPDIR
make_temp() {
local old_umask
[[ -v ORIGINAL_TMPDIR ]] && TMPDIR="$ORIGINAL_TMPDIR"
[[ -v ORIGINAL_TMPDIR ]] && export TMPDIR="$ORIGINAL_TMPDIR"
ORIGINAL_TMPDIR="$TMPDIR"
[[ -z $TMPDIR ]] && unset TMPDIR
old_umask="$(umask)"
umask 077