setopt: provide info for CURLE_BAD_FUNCTION_ARGUMENT

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
This commit is contained in:
Daniel Stenberg 2025-05-13 11:25:43 +02:00
parent a8b947e7f4
commit 0cce66b3b3
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View 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;
}