diff options
author | Marc Cornellà <hello@mcornella.com> | 2021-10-23 05:16:15 +0200 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2021-10-23 05:16:15 +0200 |
commit | f1dd97bb2a9df55fae9b1ca26c829b9f8b290667 (patch) | |
tree | 0cdc1a2b0ee7708011efae92d76706ea701766ab /plugins/ssh-agent | |
parent | 46f8765f4c871ef9b4e7f8bc448e45f4be15ff58 (diff) | |
download | zsh-f1dd97bb2a9df55fae9b1ca26c829b9f8b290667.tar.gz zsh-f1dd97bb2a9df55fae9b1ca26c829b9f8b290667.tar.bz2 zsh-f1dd97bb2a9df55fae9b1ca26c829b9f8b290667.zip |
fix(ssh-agent): fix check for running `ssh-agent` process with hidepid /proc (#8492)
Fixes #8492
Diffstat (limited to 'plugins/ssh-agent')
-rw-r--r-- | plugins/ssh-agent/ssh-agent.plugin.zsh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index c006f1413..47dfef5b0 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -6,9 +6,11 @@ function _start_agent() { if [[ -f "$ssh_env_cache" ]]; then . "$ssh_env_cache" > /dev/null - { - [[ "$USERNAME" = root ]] && command ps ax || command ps x - } | command grep ssh-agent | command grep -q $SSH_AGENT_PID && return 0 + # Test if $SSH_AUTH_SOCK is visible + zmodload zsh/net/socket + if [[ -S "$SSH_AUTH_SOCK" ]] && zsocket "$SSH_AUTH_SOCK" 2>/dev/null; then + return 0 + fi fi # Set a maximum lifetime for identities added to ssh-agent |