summaryrefslogtreecommitdiff
path: root/gitstatus/gitstatus.plugin.sh
diff options
context:
space:
mode:
Diffstat (limited to 'gitstatus/gitstatus.plugin.sh')
-rw-r--r--gitstatus/gitstatus.plugin.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/gitstatus/gitstatus.plugin.sh b/gitstatus/gitstatus.plugin.sh
index 0c660967..37b78f44 100644
--- a/gitstatus/gitstatus.plugin.sh
+++ b/gitstatus/gitstatus.plugin.sh
@@ -121,7 +121,12 @@ function gitstatus_start() {
--repo-ttl-seconds="$ttl"
$extra_flags)
- tmpdir="$(command mktemp -d "${TMPDIR:-/tmp}"/gitstatus.bash.$$.XXXXXXXXXX)" || return
+ if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
+ local tmpdir=$TMPDIR
+ else
+ local tmpdir=/tmp
+ fi
+ tmpdir="$(command mktemp -d "$tmpdir"/gitstatus.bash.$$.XXXXXXXXXX)" || return
if [[ -n "$log_level" ]]; then
GITSTATUS_DAEMON_LOG="$tmpdir"/daemon.log