Add an assortment of missing frees, and one missing file close. Mostly
[u/mdw/putty] / unix / uxagentc.c
index 7b737d1..9f579cd 100644 (file)
@@ -17,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;
 }
@@ -122,7 +123,7 @@ int agent_query(void *in, int inlen, void **out, int *outlen,
        exit(1);
     }
 
-    fcntl(sock, F_SETFD, FD_CLOEXEC);
+    cloexec(sock);
 
     addr.sun_family = AF_UNIX;
     strncpy(addr.sun_path, name, sizeof(addr.sun_path));