From: Billy O'Neal Date: Tue, 27 Jan 2026 00:03:33 +0000 (-0800) Subject: curl_multi_perform.md: resolve inconsistency X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af508e364193a0343e06233fbd5912a8c7d25f2e;p=thirdparty%2Fcurl.git curl_multi_perform.md: resolve inconsistency ... between curl_multi_perform and curl_multi_wait/poll documentation The `curl_multi_perform` documentation uses integer contextual conversion to `bool` to test the resulting `CURLMcode`, while other functions like `curl_multi_wait` and `curl_multi_poll` test against `CURLM_OK`. (I was initially confused by this as it looked like some docs call curl_multi_wait/poll on error, while some called only on success. But that was my misread, not a docs problem.) Also fixed the example to print which function call failed; previously an error reported by `curl_multi_perform` was printed as a failure of `curl_multi_wait`. Closes #20444 --- diff --git a/docs/libcurl/curl_multi_perform.md b/docs/libcurl/curl_multi_perform.md index 3856e9fd19..06ed490057 100644 --- a/docs/libcurl/curl_multi_perform.md +++ b/docs/libcurl/curl_multi_perform.md @@ -73,19 +73,25 @@ int main(void) CURL *curl = curl_easy_init(); if(curl) { curl_multi_add_handle(multi, curl); - do { + for(;;) { CURLMcode mresult = curl_multi_perform(multi, &still_running); + if(mresult != CURLM_OK) { + fprintf(stderr, "curl_multi_perform() failed, code %d.\n", + (int)mresult); + break; + } - if(!mresult && still_running) - /* wait for activity, timeout or "nothing" */ - mresult = curl_multi_poll(multi, NULL, 0, 1000, NULL); + if(!still_running) { + break; + } - if(mresult) { + /* wait for activity, timeout or "nothing" */ + mresult = curl_multi_poll(multi, NULL, 0, 1000, NULL); + if(mresult != CURLM_OK) { fprintf(stderr, "curl_multi_poll() failed, code %d.\n", (int)mresult); break; } - - } while(still_running); /* if there are still transfers, loop */ + } /* if there are still transfers, loop */ } } ~~~