CONTRIB: tcploop: fix connect's address length

FreeBSD wants the address size to be correct, so let's pass the size
of a sockaddr_in struct, not the sockaddr_storage.
This commit is contained in:
Willy Tarreau 2017-03-14 14:50:05 +01:00
parent bcd817e669
commit 24d41b9b4d

View File

@ -424,7 +424,7 @@ int tcp_connect(const struct sockaddr_storage *sa, const char *arg)
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) == -1)
goto fail;
if (connect(sock, (const struct sockaddr *)sa, sizeof(*sa)) < 0) {
if (connect(sock, (const struct sockaddr *)sa, sizeof(struct sockaddr_in)) < 0) {
if (errno != EINPROGRESS)
goto fail;
}