Skip to content

Commit

Permalink
Cygwin: pipe: do short writes only once in nonblocking case too
Browse files Browse the repository at this point in the history
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: 170e6ba ("Cygwin: pipe: improve writing when pipe buffer is almost full")
Signed-off-by: Corinna Vinschen <[email protected]>
  • Loading branch information
github-cygwin committed Aug 19, 2024
1 parent 1ed909e commit 686e46c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions winsup/cygwin/fhandler/pipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
{
Expand Down

0 comments on commit 686e46c

Please sign in to comment.