msvcrt: Make fclose thread safe.

This commit is contained in:
Piotr Caban 2011-05-20 13:21:41 +02:00 committed by Alexandre Julliard
parent d18f0766f7
commit 1b26496270
1 changed files with 2 additions and 0 deletions

View File

@ -2557,6 +2557,7 @@ int CDECL MSVCRT_fclose(MSVCRT_FILE* file)
{ {
int r, flag; int r, flag;
MSVCRT__lock_file(file);
flag = file->_flag; flag = file->_flag;
MSVCRT_free(file->_tmpfname); MSVCRT_free(file->_tmpfname);
file->_tmpfname = NULL; file->_tmpfname = NULL;
@ -2569,6 +2570,7 @@ int CDECL MSVCRT_fclose(MSVCRT_FILE* file)
r=MSVCRT__close(file->_file); r=MSVCRT__close(file->_file);
file->_flag = 0; file->_flag = 0;
MSVCRT__unlock_file(file);
if(file<MSVCRT__iob || file>=MSVCRT__iob+_IOB_ENTRIES) if(file<MSVCRT__iob || file>=MSVCRT__iob+_IOB_ENTRIES)
DeleteCriticalSection(&((file_crit*)file)->crit); DeleteCriticalSection(&((file_crit*)file)->crit);