From: Alexander Barton Date: Mon, 5 Jul 2021 20:01:13 +0000 (+0200) Subject: 30_env.ax-io: Try to use a user-specific subfolder when TMPDIR is not set X-Git-Url: https://arthur.ath.cx/gitweb/?a=commitdiff_plain;h=6648cf958c589c8245e6f4ad3d753e88a483fef6;p=ax-zsh.git 30_env.ax-io: Try to use a user-specific subfolder when TMPDIR is not set --- diff --git a/core/30_env/30_env.ax-io b/core/30_env/30_env.ax-io index 1910bd4..84bd1c2 100644 --- a/core/30_env/30_env.ax-io +++ b/core/30_env/30_env.ax-io @@ -9,7 +9,14 @@ fi # Validate temporary directory if [[ -z "$TMPDIR" ]]; then TMPDIR="$(dirname $(mktemp -ut tmp.XXXXXXXXXX))/" + user_tmpdir="$TMPDIR$UID" + mkdir -p "$user_tmpdir" >/dev/null 2>&1 + if [[ -w "$user_tmpdir" ]]; then + TMPDIR="$user_tmpdir/" + chmod 0700 "$TMPDIR" + fi echo "WARNING: \"TMPDIR\" is not set, using \"$TMPDIR\" as default!" >&2 + unset user_tmpdir fi if [[ ! -w "$TMPDIR" ]]; then echo "WARNING: Temporary directory \"$TMPDIR\" is not writable!" >&2