1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2026-04-18 13:24:04 +00:00

Make the persistent SSH authentication socket symlink creation atomic

This commit is contained in:
David Tagatac
2026-03-22 13:13:51 -07:00
committed by Indrajit Raychaudhuri
parent a1c01ff39f
commit 4efeccfefc

View File

@@ -34,7 +34,8 @@ fi
# Create a persistent SSH authentication socket.
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
mkdir -p "$_ssh_agent_sock:h"
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock"
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock.$$"
mv -f "$_ssh_agent_sock.$$" "$_ssh_agent_sock"
export SSH_AUTH_SOCK="$_ssh_agent_sock"
fi