I've just discovered that using the saved sessions menu from Unix
[u/mdw/putty] / unix / uxagentc.c
index 826e439..7b737d1 100644 (file)
@@ -8,6 +8,7 @@
 #include <unistd.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <fcntl.h>
 
 #include "putty.h"
 #include "misc.h"
@@ -121,6 +122,8 @@ int agent_query(void *in, int inlen, void **out, int *outlen,
        exit(1);
     }
 
+    fcntl(sock, F_SETFD, FD_CLOEXEC);
+
     addr.sun_family = AF_UNIX;
     strncpy(addr.sun_path, name, sizeof(addr.sun_path));
     if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {