msvcrt: Allocate buffer in fwrite function.

This commit is contained in:
Piotr Caban 2012-11-02 17:18:34 +01:00 committed by Alexandre Julliard
parent 4455250a98
commit ec26342c88
1 changed files with 6 additions and 1 deletions

View File

@ -2919,8 +2919,13 @@ MSVCRT_size_t CDECL MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_si
}
}
if(wrcnt) {
int res;
if(file->_bufsiz == 0 && !(file->_flag & MSVCRT__IONBF))
msvcrt_alloc_buffer(file);
/* Flush buffer */
int res=msvcrt_flush_buffer(file);
res=msvcrt_flush_buffer(file);
if(!res) {
int pwritten = MSVCRT__write(file->_file, ptr, wrcnt);
if (pwritten <= 0)