use sane dir if $TMPDIR is not set
This commit is contained in:
parent
fb549f108a
commit
9302507257
1 changed files with 10 additions and 2 deletions
|
@ -7,8 +7,16 @@ if (( ! ${+commands[ssh-agent]} )); then
|
|||
return 1
|
||||
fi
|
||||
|
||||
local ssh_env=${TMPDIR:-/tmp}/ssh-agent.env
|
||||
local ssh_sock=${TMPDIR:-/tmp}/ssh-agent.sock
|
||||
# use a sane temp dir; creating 1k ssh-* files in /tmp is crazy
|
||||
if [[ ${TMPDIR} ]]; then
|
||||
local ssh_env=${TMPDIR}/ssh-agent.env
|
||||
local ssh_sock=${TMPDIR}/ssh-agent.sock
|
||||
else
|
||||
# create a sane tmp dir at /tmp/username
|
||||
mkdir -p /tmp/${USER}
|
||||
local ssh_env=/tmp/${USER}
|
||||
local ssh_sock=/tmp/${USER}
|
||||
fi
|
||||
|
||||
# start ssh-agent if not already running
|
||||
if [[ ! -S ${SSH_AUTH_SOCK} ]]; then
|
||||
|
|
Loading…
Reference in a new issue