From: Viktor Szakats Date: Thu, 20 Oct 2022 09:09:36 +0000 (+0000) Subject: connect: fix builds without AF_INET6 X-Git-Tag: curl-7_86_0~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3dc8f6f2557af28855fb21ca4ff0baddb59de72c;p=thirdparty%2Fcurl.git connect: fix builds without AF_INET6 Regression from 2b309560c1e5d6ed5c0e542e6fdffa968b0521c9 Reviewed-by: Daniel Stenberg Reviewed-by: Jay Satiro Closes #9770 --- diff --git a/lib/connect.c b/lib/connect.c index 9dc14704df..ac007c61b0 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -1197,6 +1197,7 @@ static CURLcode singleipconnect(struct Curl_easy *data, #ifdef TCP_FASTOPEN_CONNECT int optval = 1; #endif + const char *ipmsg; char buffer[STRERROR_LEN]; curl_socket_t *sockp = &conn->tempsock[tempindex]; *sockp = CURL_SOCKET_BAD; @@ -1214,11 +1215,13 @@ static CURLcode singleipconnect(struct Curl_easy *data, Curl_closesocket(data, conn, sockfd); return CURLE_OK; } - infof(data, " Trying %s%s%s:%d...", - (addr.family == AF_INET6 ? "[" : ""), - ipaddress, - (addr.family == AF_INET6 ? "]" : ""), - port); +#ifdef ENABLE_IPV6 + if(addr.family == AF_INET6) + ipmsg = " Trying [%s]:%d..."; + else +#endif + ipmsg = " Trying %s:%d..."; + infof(data, ipmsg, ipaddress, port); #ifdef ENABLE_IPV6 is_tcp = (addr.family == AF_INET || addr.family == AF_INET6) &&