44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
|
--- agent/gpg-agent.c
|
||
|
+++ agent/gpg-agent.c
|
||
|
@@ -789,6 +789,10 @@
|
||
|
int fd_ssh;
|
||
|
pid_t pid;
|
||
|
|
||
|
+ char *tmp1, *tmp;
|
||
|
+ char *tmp2 = "gpg-XXXXXX/S.gpg-agent";
|
||
|
+ size_t len;
|
||
|
+
|
||
|
/* Remove the DISPLAY variable so that a pinentry does not
|
||
|
default to a specific display. There is still a default
|
||
|
display when gpg-agent was started using --display or a
|
||
|
@@ -800,16 +804,26 @@
|
||
|
unsetenv ("DISPLAY");
|
||
|
#endif
|
||
|
|
||
|
+ if ((tmp1 = getenv("TMPDIR")) == NULL)
|
||
|
+ tmp1 = "/tmp";
|
||
|
+
|
||
|
+ len = strlen(tmp1) + strlen(tmp2) + 10;
|
||
|
+ tmp = malloc(len);
|
||
|
+
|
||
|
+ snprintf(tmp, len, "%s%s%s", tmp1, tmp1 && strlen(tmp1) > 0 ? "/" : "", tmp2);
|
||
|
|
||
|
/* Create the sockets. */
|
||
|
socket_name = create_socket_name (standard_socket,
|
||
|
"S.gpg-agent",
|
||
|
- "/tmp/gpg-XXXXXX/S.gpg-agent");
|
||
|
- if (opt.ssh_support)
|
||
|
+ tmp);
|
||
|
+ if (opt.ssh_support) {
|
||
|
+ snprintf(tmp, len, "%s%s%s.ssh", tmp1, tmp1 && strlen(tmp1) > 0 ? "/" : "", tmp2);
|
||
|
socket_name_ssh = create_socket_name (standard_socket,
|
||
|
"S.gpg-agent.ssh",
|
||
|
- "/tmp/gpg-XXXXXX/S.gpg-agent.ssh");
|
||
|
+ tmp);
|
||
|
+ }
|
||
|
|
||
|
+ free(tmp);
|
||
|
fd = create_server_socket (standard_socket, socket_name);
|
||
|
if (opt.ssh_support)
|
||
|
fd_ssh = create_server_socket (standard_socket, socket_name_ssh);
|