]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_cb_hdr: return error for failed header writes
authorDaniel Stenberg <daniel@haxx.se>
Sun, 2 Jun 2024 15:16:58 +0000 (17:16 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 2 Jun 2024 21:24:19 +0000 (23:24 +0200)
By checking that fflush() works.

Reported-by: Sebastian Andersson
Fixes #13836
Closes #13859

src/tool_cb_hdr.c

index dab4bb01c15bf5e7528e0034bb000ec720009d9c..04c5ba907b29af028420346abe1bb18a9775c5f5 100644 (file)
@@ -105,7 +105,11 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
     if(rc != cb)
       return rc;
     /* flush the stream to send off what we got earlier */
-    (void)fflush(heads->stream);
+    if(fflush(heads->stream)) {
+      errorf(per->config->global, "Failed writing headers to %s",
+             per->config->headerfile);
+      return CURL_WRITEFUNC_ERROR;
+    }
   }
 
   curl_easy_getinfo(per->curl, CURLINFO_SCHEME, &scheme);