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

msvcrt: Allocate buffer in fwrite function.

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