]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
examples: return `curl_easy_perform()` results
authorViktor Szakats <commit@vsz.me>
Mon, 13 Oct 2025 14:18:40 +0000 (16:18 +0200)
committerViktor Szakats <commit@vsz.me>
Mon, 13 Oct 2025 15:58:30 +0000 (17:58 +0200)
Where missing. Or explicitly `(void)` it where we ignore it on purpose.

Reported-by: Joshua Rogers (for `sepheaders.c`)
Closes #19052

docs/examples/multithread.c
docs/examples/sepheaders.c
docs/examples/smooth-gtk-thread.c
docs/examples/threaded-ssl.c
docs/examples/url2file.c

index b98977c443db3d967ed3834f5e441fbd2611d4b0..a47758062f5dadaa8c95c1c79524e7bbbff968c5 100644 (file)
@@ -57,7 +57,7 @@ static void *pull_one_url(void *pindex)
 
   curl = curl_easy_init();
   curl_easy_setopt(curl, CURLOPT_URL, urls[i]);
-  curl_easy_perform(curl); /* ignores error */
+  (void)curl_easy_perform(curl); /* ignores error */
   curl_easy_cleanup(curl);
 
   return NULL;
index 8f48033a0d717b536e76e0c1d7645891d6b13cb3..097183f82169f6ad1f516a5ef1abc1be68f02771 100644 (file)
@@ -38,6 +38,7 @@ static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
 
 int main(void)
 {
+  CURLcode res;
   CURL *curl_handle;
   static const char *headerfilename = "head.out";
   FILE *headerfile;
@@ -80,7 +81,7 @@ int main(void)
   curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, bodyfile);
 
   /* get it! */
-  curl_easy_perform(curl_handle);
+  res = curl_easy_perform(curl_handle);
 
   /* close the header file */
   fclose(headerfile);
@@ -93,5 +94,5 @@ int main(void)
 
   curl_global_cleanup();
 
-  return 0;
+  return (int)res;
 }
index dc79276ba8a475866a53d1031963511fcc1412d2..3b615cb344c3dd0f506d00b530a08069fd14e55a 100644 (file)
@@ -80,7 +80,7 @@ static void run_one(gchar *http, int j)
     /* Write to the file */
     curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_file);
-    curl_easy_perform(curl);
+    (void)curl_easy_perform(curl);
 
     fclose(outfile);
     curl_easy_cleanup(curl);
index 98377ee84040690e9ad7a4f7fce9fe44340a7ed4..fb60b7f16050e56b18a66aa865c587eb8adb88e2 100644 (file)
@@ -64,7 +64,7 @@ static void *pull_one_url(void *pindex)
      might be downloading stuff from an impostor */
   curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
   curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
-  curl_easy_perform(curl); /* ignores error */
+  (void)curl_easy_perform(curl); /* ignores error */
   curl_easy_cleanup(curl);
 
   return NULL;
index 9ed7da5a84a637c105eeb7e072b32e7bbc97a019..c55d2a77c792e656d216f8c8b88497c1db4810ed 100644 (file)
@@ -38,6 +38,8 @@ static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
 
 int main(int argc, char *argv[])
 {
+  CURLcode res = CURLE_OK;
+
   CURL *curl_handle;
   static const char *pagefilename = "page.out";
   FILE *pagefile;
@@ -72,7 +74,7 @@ int main(int argc, char *argv[])
     curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, pagefile);
 
     /* get it! */
-    curl_easy_perform(curl_handle);
+    res = curl_easy_perform(curl_handle);
 
     /* close the header file */
     fclose(pagefile);
@@ -83,5 +85,5 @@ int main(int argc, char *argv[])
 
   curl_global_cleanup();
 
-  return 0;
+  return (int)res;
 }