]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
connect: fix the wrong error message on connect failures
authorDaniel Stenberg <daniel@haxx.se>
Wed, 21 Sep 2022 07:06:49 +0000 (09:06 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 21 Sep 2022 12:23:37 +0000 (14:23 +0200)
The "Failed to connect to" message after a connection failure would
include the strerror message based on the presumed previous socket
error, but in times it seems that error number is not set when reaching
this code and therefore it would include the wrong error message.

The strerror message is now removed from here and the curl_easy_strerror
error is used instead.

Reported-by: Edoardo Lolletti
Fixes #9549
Closes #9554

lib/connect.c

index d2c3ef267413301d327d0d87a3dc3fbdc85eeb02..13491c9817a2976c7ae637964562827e5992d8b5 100644 (file)
@@ -1047,7 +1047,6 @@ CURLcode Curl_is_connected(struct Curl_easy *data,
      (conn->tempsock[1] == CURL_SOCKET_BAD)) {
     /* no more addresses to try */
     const char *hostname;
-    char buffer[STRERROR_LEN];
     CURLcode failreason = result;
 
     /* if the first address family runs out of addresses to try before the
@@ -1074,11 +1073,7 @@ CURLcode Curl_is_connected(struct Curl_easy *data,
           "%" CURL_FORMAT_TIMEDIFF_T " ms: %s",
           hostname, conn->port,
           Curl_timediff(now, data->progress.t_startsingle),
-#ifdef ENABLE_QUIC
-          (conn->transport == TRNSPRT_QUIC) ?
-          curl_easy_strerror(result) :
-#endif
-          Curl_strerror(error, buffer, sizeof(buffer)));
+          curl_easy_strerror(result));
 
     Curl_quic_disconnect(data, conn, 0);
     Curl_quic_disconnect(data, conn, 1);