]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
setopt: provide info for CURLE_BAD_FUNCTION_ARGUMENT
authorDaniel Stenberg <daniel@haxx.se>
Tue, 13 May 2025 09:25:43 +0000 (11:25 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 13 May 2025 12:18:19 +0000 (14:18 +0200)
If CURLE_BAD_FUNCTION_ARGUMENT is returned and failf() has not provided
any details, this adds a generic error string that includes the option
number.

This helps debugging for example the curl tool which does a lot of
setopt calls and in reading post fact logs it is not always easy to tell
exactly which call that failed.

Closes #17337

lib/setopt.c

index aa8043dc9609c574034414fe3000315baa92f2fc..885fa8e75d34439355cda09cf5cd07965071c2c0 100644 (file)
@@ -3070,9 +3070,7 @@ CURLcode curl_easy_setopt(CURL *d, CURLoption tag, ...)
   result = Curl_vsetopt(data, tag, arg);
 
   va_end(arg);
-#ifdef DEBUGBUILD
   if(result == CURLE_BAD_FUNCTION_ARGUMENT)
-    infof(data, "setopt arg 0x%x returned CURLE_BAD_FUNCTION_ARGUMENT", tag);
-#endif
+    failf(data, "setopt 0x%x got bad argument", tag);
   return result;
 }