agent: Not remove SSH socket when already running.

NIIBE Yutaka gniibe at fsij.org
Thu Jan 16 02:10:15 CET 2014


Hello,

I tried to push my changes to master, and I found another problem.
When SSH support is enabled and gpg-agent is already running, the
socket for SSH will be removed.  (And I can't use SSH.)

This is obvious bug and simple fix, so, I'm going to push this.

    * 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.

diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index ed664ea..1e60717 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;
 
-- 





More information about the Gnupg-devel mailing list