]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
connect: fix builds without AF_INET6
authorViktor Szakats <commit@vsz.me>
Thu, 20 Oct 2022 09:09:36 +0000 (09:09 +0000)
committerViktor Szakats <commit@vsz.me>
Thu, 20 Oct 2022 09:09:36 +0000 (09:09 +0000)
Regression from 2b309560c1e5d6ed5c0e542e6fdffa968b0521c9

Reviewed-by: Daniel Stenberg
Reviewed-by: Jay Satiro
Closes #9770

lib/connect.c

index 9dc14704df845b7ac10a4d7eb1e086e034d7ddc8..ac007c61b0c0713615f055d04000d47f73b9701e 100644 (file)
@@ -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) &&