X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/51e9d3c00a3471f284e89ec1f59f38ca25f10c5f..b8487fe0a21369fbb9e97616532f8395130bf18c:/unix/uxagentc.c diff --git a/unix/uxagentc.c b/unix/uxagentc.c index 826e4394..9f579cd9 100644 --- a/unix/uxagentc.c +++ b/unix/uxagentc.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "putty.h" #include "misc.h" @@ -16,7 +17,8 @@ int agent_exists(void) { - if (getenv("SSH_AUTH_SOCK") != NULL) + const char *p = getenv("SSH_AUTH_SOCK"); + if (p && *p) return TRUE; return FALSE; } @@ -121,6 +123,8 @@ int agent_query(void *in, int inlen, void **out, int *outlen, exit(1); } + cloexec(sock); + addr.sun_family = AF_UNIX; strncpy(addr.sun_path, name, sizeof(addr.sun_path)); if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {