]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
transfer: fix returning init failures from `xfer_recv_shutdown_started()`
authorViktor Szakats <commit@vsz.me>
Tue, 4 Feb 2025 17:15:22 +0000 (18:15 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 5 Feb 2025 00:12:18 +0000 (01:12 +0100)
Before this patch it returned `CURLE_FAILED_INIT` on init failures, with
the value of 2. Fix it to return `false`.

Seen with clang 18.1.8:
```
../lib/transfer.c(181,12): warning: integer constant not in range of enumerated type 'bool' [-Wassign-enum]
  181 |     return CURLE_FAILED_INIT;
      |            ^
../lib/transfer.c(181,12): warning: implicit conversion from enumeration type 'CURLcode' to different enumeration type 'bool' [-Wenum-conversion]
  181 |     return CURLE_FAILED_INIT;
      |     ~~~~~~ ^~~~~~~~~~~~~~~~~
../lib/transfer.c(183,12): warning: integer constant not in range of enumerated type 'bool' [-Wassign-enum]
  183 |     return CURLE_FAILED_INIT;
      |            ^
../lib/transfer.c(183,12): warning: implicit conversion from enumeration type 'CURLcode' to different enumeration type 'bool' [-Wenum-conversion]
  183 |     return CURLE_FAILED_INIT;
      |     ~~~~~~ ^~~~~~~~~~~~~~~~~
```

Follow-up to 35bf766280a77cde3055e0f4e249ab02a0dcd275 #14253

Closes #16170

lib/transfer.c

index 83e894750fdb0a6ba77a461f9c6cc17139724c7e..ba4616138885c22180ef5f7806b5bd856030a0a3 100644 (file)
@@ -176,9 +176,9 @@ static bool xfer_recv_shutdown_started(struct Curl_easy *data)
   int sockindex;
 
   if(!data || !data->conn)
-    return CURLE_FAILED_INIT;
+    return false;
   if(data->conn->sockfd == CURL_SOCKET_BAD)
-    return CURLE_FAILED_INIT;
+    return false;
   sockindex = (data->conn->sockfd == data->conn->sock[SECONDARYSOCKET]);
   return Curl_shutdown_started(data, sockindex);
 }