aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2024-08-19 11:51:14 +0200
committerCorinna Vinschen <corinna@vinschen.de>2024-08-19 11:51:14 +0200
commit686e46ce714803f47d3183c954ceaf51976157cc (patch)
tree403b0818ba64696a0c178e7f815d9cf04b12f7c9
parent1ed909e047a22b8a2bdaed437d9dc974571835b8 (diff)
downloadnewlib-686e46ce714803f47d3183c954ceaf51976157cc.zip
newlib-686e46ce714803f47d3183c954ceaf51976157cc.tar.gz
newlib-686e46ce714803f47d3183c954ceaf51976157cc.tar.bz2
Cygwin: pipe: do short writes only once in nonblocking case too
If a nonblocking write requires short writes, just try it once as in the blocking case. After all, we are nonblocking, so don't loop unnecessarily. Fixes: 170e6badb621 ("Cygwin: pipe: improve writing when pipe buffer is almost full") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/fhandler/pipe.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler/pipe.cc b/winsup/cygwin/fhandler/pipe.cc
index 34b295c..852076c 100644
--- a/winsup/cygwin/fhandler/pipe.cc
+++ b/winsup/cygwin/fhandler/pipe.cc
@@ -574,8 +574,7 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
len1 = avail & ~(PIPE_BUF - 1);
else
len1 = 1 << (31 - __builtin_clzl (avail));
- if (!is_nonblocking ())
- short_write_once = true;
+ short_write_once = true;
}
if (isclosed ()) /* A signal handler might have closed the fd. */
{