[PATCH] msvcrt: Fix early pipe closing

Nguyễn Thái Ngọc Duy pclouds at gmail.com
Sat Feb 2 02:26:51 CST 2008


Pipes are not like other normal files. If we do not read enough
bytes, it does not mean it reaches EOF

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds at gmail.com>
---
 I'm not sure if it applies to some other file types as well but it
 surely fixes broken pipe on git-fetch-pack (MinGW port)

 dlls/msvcrt/file.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index b4ccdc0..4e3e200 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -1698,8 +1698,11 @@ static int read_i(int fd, void *buf, unsigned int count)
         }
         if (num_read != count)
         {
-            MSVCRT_fdesc[fd].wxflag |= (WX_ATEOF|WX_READEOF);
-            TRACE(":EOF %s\n",debugstr_an(buf,num_read));
+            DWORD type = GetFileType(hand);
+            if (type != FILE_TYPE_PIPE) {
+                MSVCRT_fdesc[fd].wxflag |= (WX_ATEOF|WX_READEOF);
+                TRACE(":EOF %s\n",debugstr_an(buf,num_read));
+	    }
         }
     }
     else
-- 
1.5.4.rc2.1097.gb6e0d



More information about the wine-patches mailing list