msvcrt: Make setvbuf thread safe.

This commit is contained in:
Piotr Caban 2011-05-20 13:22:10 +02:00 committed by Alexandre Julliard
parent c989c4980b
commit eb01bc1efa
1 changed files with 2 additions and 1 deletions

View File

@ -3479,7 +3479,7 @@ int CDECL _wrename(const MSVCRT_wchar_t *oldpath,const MSVCRT_wchar_t *newpath)
*/ */
int CDECL MSVCRT_setvbuf(MSVCRT_FILE* file, char *buf, int mode, MSVCRT_size_t size) int CDECL MSVCRT_setvbuf(MSVCRT_FILE* file, char *buf, int mode, MSVCRT_size_t size)
{ {
/* TODO: Check if file busy */ MSVCRT__lock_file(file);
if(file->_bufsiz) { if(file->_bufsiz) {
MSVCRT_free(file->_base); MSVCRT_free(file->_base);
file->_bufsiz = 0; file->_bufsiz = 0;
@ -3494,6 +3494,7 @@ int CDECL MSVCRT_setvbuf(MSVCRT_FILE* file, char *buf, int mode, MSVCRT_size_t s
} else { } else {
file->_flag |= MSVCRT__IONBF; file->_flag |= MSVCRT__IONBF;
} }
MSVCRT__unlock_file(file);
return 0; return 0;
} }