From af508e364193a0343e06233fbd5912a8c7d25f2e Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Mon, 26 Jan 2026 16:03:33 -0800 Subject: [PATCH] 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 --- docs/libcurl/curl_multi_perform.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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 && still_running) - /* wait for activity, timeout or "nothing" */ - mresult = curl_multi_poll(multi, NULL, 0, 1000, NULL); - - if(mresult) { - fprintf(stderr, "curl_multi_poll() failed, code %d.\n", (int)mresult); + if(mresult != CURLM_OK) { + fprintf(stderr, "curl_multi_perform() failed, code %d.\n", + (int)mresult); break; } - } while(still_running); /* if there are still transfers, loop */ + if(!still_running) { + break; + } + + /* 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; + } + } /* if there are still transfers, loop */ } } ~~~