10 Oct
2014
10 Oct
'14
9:29 a.m.
On 10/09/14 19:52, Iván Matellanes wrote:
@@ -921,22 +921,36 @@ int CDECL MSVCRT_fflush(MSVCRT_FILE* file) { if(!file) { msvcrt_flush_all_buffers(MSVCRT__IOWRT); + } else if(file->_flag & MSVCRT__IOWRT || file->_flag & MSVCRT__IOREAD) { + int ret; + + MSVCRT__lock_file(file); + ret = MSVCRT__fflush_nolock(file); + MSVCRT__unlock_file(file); + + return ret; + } + return 0; +} file->_flag should be checked inside the lock (it's already done inside fflush_nolock). Could you please change the code to something like this: if(!file) msvcrt_flush_all_buffers(MSVCRT__IOWRT);
MSVCRT__lock_file(file); ret = MSVCRT__fflush_nolock(file); MSVCRT__unlock_file(file); Thanks, Piotr