From a5be8e2c3f9cdbf0725d7b25ab3255249253e9e8 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Tue, 15 Apr 2025 14:01:19 +0200 Subject: [PATCH] tool_cb_write.c: handle EINTR on flush Report-and-patch-by: Nils Goroll Fixes #17061 Closes #17063 --- src/tool_cb_wrt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index 7a575c98f6..1cd0524df6 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -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; }