4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 12:59:21 +08:00

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>
This commit is contained in:
Corinna Vinschen 2024-08-19 11:51:14 +02:00
parent 1ed909e047
commit 686e46ce71

View File

@ -574,8 +574,7 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
len1 = avail & ~(PIPE_BUF - 1); len1 = avail & ~(PIPE_BUF - 1);
else else
len1 = 1 << (31 - __builtin_clzl (avail)); 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. */ if (isclosed ()) /* A signal handler might have closed the fd. */
{ {