summaryrefslogtreecommitdiff
path: root/plugins/ssh-agent
diff options
context:
space:
mode:
authorAlexander Schlüter <alx.schlueter@gmail.com>2024-03-25 12:27:21 +0100
committerGitHub <noreply@github.com>2024-03-25 12:27:21 +0100
commit3e05befaeee60a0f8522f470292c75046b05ceb9 (patch)
treee63a7ac87f060b2f9f26d495b5cea7fd4c44fae6 /plugins/ssh-agent
parentd157fc60c93fa59e757921b503e9594bd23b422c (diff)
downloadzsh-3e05befaeee60a0f8522f470292c75046b05ceb9.tar.gz
zsh-3e05befaeee60a0f8522f470292c75046b05ceb9.tar.bz2
zsh-3e05befaeee60a0f8522f470292c75046b05ceb9.zip
fix(ssh-agent): don't start new agent if screen/tmux symlink exists (#12297)
Diffstat (limited to 'plugins/ssh-agent')
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index 49ad95a11..77c422ce1 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -98,8 +98,10 @@ function _add_identities() {
# Add a nifty symlink for screen/tmux if agent forwarding is enabled
if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
- && [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then
- ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
+ && [[ -n "$SSH_AUTH_SOCK" ]]; then
+ if [[ ! -L "$SSH_AUTH_SOCK" ]]; then
+ ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
+ fi
else
_start_agent
fi