msvcrt: Standard streams are valid file descriptors

André Hentschel nerv at dawncrow.de
Tue Aug 18 07:08:51 CDT 2009


writing a testcase is hard, i dont know how to reproduce the special case the problem occurs. So i hope this patch is clear enough.
It also fixes Bug 18479

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

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 6671f2f..6acb699 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -153,7 +153,7 @@ static void time_to_filetime( MSVCRT___time64_t time, FILETIME *ft )
 
 static inline BOOL msvcrt_is_valid_fd(int fd)
 {
-  return fd >= 0 && fd < MSVCRT_fdend && (MSVCRT_fdesc[fd].wxflag & WX_OPEN);
+  return fd >= 0 && (fd < MSVCRT_fdend || fd < MSVCRT_stream_idx) && (MSVCRT_fdesc[fd].wxflag & WX_OPEN);
 }
 
 /* INTERNAL: Get the HANDLE for a fd
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list