Flush output buffers from _close() rather than MSVCRT_fclose().

This commit is contained in:
2005-05-12 09:55:02 +00:00 committed by Alexandre Julliard
parent fd62fcf0ef
commit 894c1364d4
1 changed files with 7 additions and 3 deletions

View File

@ -773,9 +773,13 @@ int MSVCRT__fcloseall(void)
void msvcrt_free_io(void)
{
MSVCRT__fcloseall();
_close(0);
_close(1);
_close(2);
/* The Win32 _fcloseall() function explicitly doesn't close stdin,
* stdout, and stderr (unlike GNU), so we need to fclose() them here
* or they won't get flushed.
*/
MSVCRT_fclose(&MSVCRT__iob[0]);
MSVCRT_fclose(&MSVCRT__iob[1]);
MSVCRT_fclose(&MSVCRT__iob[2]);
DeleteCriticalSection(&MSVCRT_file_cs);
}