Commit eb01bc1e authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Make setvbuf thread safe.

parent c989c498
...@@ -3479,7 +3479,7 @@ int CDECL _wrename(const MSVCRT_wchar_t *oldpath,const MSVCRT_wchar_t *newpath) ...@@ -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 ...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment