#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
+#include <fcntl.h>
#include "putty.h"
#include "misc.h"
int agent_exists(void)
{
- if (getenv("SSH_AUTH_SOCK") != NULL)
+ const char *p = getenv("SSH_AUTH_SOCK");
+ if (p && *p)
return TRUE;
return FALSE;
}
}
conn->retlen += ret;
if (conn->retsize == 4 && conn->retlen == 4) {
- conn->retsize = GET_32BIT(conn->retbuf);
+ conn->retsize = toint(GET_32BIT(conn->retbuf) + 4);
if (conn->retsize <= 0) {
conn->retbuf = NULL;
conn->retlen = 0;
goto done;
}
- conn->retsize += 4;
assert(conn->retbuf == conn->sizebuf);
conn->retbuf = snewn(conn->retsize, char);
memcpy(conn->retbuf, conn->sizebuf, 4);
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) {