1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 06:58:01 +00:00

[runcoms/zprofile+zshenv] Ensure TMPDIR is always set

In some cases TMPDIR may not be set, in which case it could cause issues
for zsh modules.

This change was prompted by issue #1331.

Also when creating a missing TMPDIR, use mkdir --mode=700 instead
of creating the directory and then chmoding it afterward.
This commit is contained in:
Samantha McVey 2017-06-26 14:52:59 -07:00 committed by Kaleb Elwert
parent e52523204b
commit a4ff6acd56
2 changed files with 6 additions and 6 deletions

View File

@ -66,11 +66,11 @@ fi
# Temporary Files
#
#
if [[ -z "$TMPDIR" ]]; then
export TMPDIR="/tmp/zsh-$UID"
# Set TMPDIR if the variable is not set/empty or the directory doesn't exist
if [[ -z "${TMPDIR}" ]]; then
export TMPDIR="/tmp/zsh-${UID}"
fi
if [[ ! -d "$TMPDIR" ]]; then
mkdir "$TMPDIR"
chmod 700 "$TMPDIR"
if [[ ! -d "${TMPDIR}" ]]; then
mkdir -m 700 "${TMPDIR}"
fi

View File

@ -6,6 +6,6 @@
#
# Ensure that a non-login, non-interactive shell has a defined environment.
if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN || -z "${TMPDIR}" ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
source "${ZDOTDIR:-$HOME}/.zprofile"
fi