X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fuxagentc.c;h=9f579cd9488bda6efc085b30b4d6dcc65c413e12;hb=a580c22c2419a9236466ca8ee80bc97bc9da41eb;hp=826e4394b6d6f7e5b9bb23f547c8129ca0245ffc;hpb=6eec320f0b3606f17f06a290acdbb8f84afdff00;p=PuTTY.git 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) {