From 0ee66a6f66d7389e381fffa5f9eedbc8de9add10 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 16 Jan 2014 10:00:17 +0900 Subject: [PATCH] agent: Not remove SSH socket when already running. * agent/gpg-agent.c (main): Defer setting of socket_name_ssh to avoid removal of the socket when it will die in create_server_socket for socket_name. Signed-off-by: NIIBE Yutaka --- agent/gpg-agent.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index ed664ea74..1e6071733 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -1045,13 +1045,14 @@ main (int argc, char **argv ) /* Create the sockets. */ socket_name = create_socket_name (GPG_AGENT_SOCK_NAME, "gpg-XXXXXX/"GPG_AGENT_SOCK_NAME); - if (opt.ssh_support) - socket_name_ssh = create_socket_name - (GPG_AGENT_SSH_SOCK_NAME, "gpg-XXXXXX/"GPG_AGENT_SSH_SOCK_NAME); fd = create_server_socket (socket_name, 0, &socket_nonce); if (opt.ssh_support) - fd_ssh = create_server_socket (socket_name_ssh, 1, &socket_nonce_ssh); + { + socket_name_ssh = create_socket_name + (GPG_AGENT_SSH_SOCK_NAME, "gpg-XXXXXX/"GPG_AGENT_SSH_SOCK_NAME); + fd_ssh = create_server_socket (socket_name_ssh, 1, &socket_nonce_ssh); + } else fd_ssh = GNUPG_INVALID_FD;