msvcrt: fix fflush() of files opened for read, fixes bug 4831

Dan Kegel dank at kegel.com
Fri Mar 24 11:10:00 CST 2006


[repost in case my other account got filtered out]

Some apps, for no particular reason, call fflush() on files
opened for read.  This keeps them from tripping over their
shoelaces.

--- dlls/msvcrt/file.c  17 Feb 2006 17:42:52 -0000      1.97
+++ dlls/msvcrt/file.c  24 Mar 2006 16:47:55 -0000
@@ -588,11 +588,11 @@
 {
   if(!file) {
        _flushall();
-       return 0;
-  } else {
+  } else if(file->_flag & MSVCRT__IOWRT) {
        int res=msvcrt_flush_buffer(file);
        return res;
   }
+  return 0;
 }

 /*********************************************************************


--
Wine for Windows ISVs: http://kegel.com/wine/isv



More information about the wine-patches mailing list