]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_cb_write.c: handle EINTR on flush
authorStefan Eissing <stefan@eissing.org>
Tue, 15 Apr 2025 12:01:19 +0000 (14:01 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 15 Apr 2025 15:28:33 +0000 (17:28 +0200)
Report-and-patch-by: Nils Goroll
Fixes #17061
Closes #17063

src/tool_cb_wrt.c

index 7a575c98f6b1b13351368a7ade909015dc078551..1cd0524df6cab5628ed7a819201d2ab71a7cbc26 100644 (file)
@@ -364,7 +364,12 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
 
   if(config->nobuffer) {
     /* output buffering disabled */
-    int res = fflush(outs->stream);
+    int res;
+    do {
+      res = fflush(outs->stream);
+      /* Keep retrying in the hope that it is not interrupted sometime */
+      /* !checksrc! disable ERRNOVAR 1 */
+    } while(res && errno == EINTR);
     if(res)
       return CURL_WRITEFUNC_ERROR;
   }