https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1ed909e047a22b8a2bdaed437d9dc974571835b8

commit 1ed909e047a22b8a2bdaed437d9dc974571835b8
Author:     Corinna Vinschen <[email protected]>
AuthorDate: Mon Aug 19 11:44:42 2024 +0200
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Mon Aug 19 11:44:42 2024 +0200

    Cygwin: pipe: fix comparison
    
    There's no reason to overwrite len1 with align if they are the same value.
    
    Fixes: 170e6badb621 ("Cygwin: pipe: improve writing when pipe buffer is 
almost full")
    Signed-off-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/fhandler/pipe.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler/pipe.cc b/winsup/cygwin/fhandler/pipe.cc
index 33ab11744e91..34b295c4de0a 100644
--- a/winsup/cygwin/fhandler/pipe.cc
+++ b/winsup/cygwin/fhandler/pipe.cc
@@ -566,7 +566,7 @@ fhandler_pipe_fifo::raw_write (const void *ptr, size_t len)
                                               PDA_WRITE);
          if (avail < 1)        /* error or pipe closed */
            break;
-         if (avail >= len1)    /* somebody read from the pipe */
+         if (avail > len1)     /* somebody read from the pipe */
            avail = len1;
          if (avail == 1)       /* 1 byte left or non-Cygwin pipe */
            len1 >>= 1;

Reply via email to