From b88b982ada53b5aca0568c238f6d4908f592e2c7 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 3 Apr 2024 17:26:55 +0200 Subject: [PATCH] ucrtbase: Let stderr be always be unbuffered. Signed-off-by: Eric Pouech (cherry picked from commit 8825f4dfa5e72834577aef58810b967c53965f93) Link: https://github.com/ValveSoftware/wine/issues/224 --- dlls/msvcrt/file.c | 6 ++++++ dlls/ucrtbase/tests/file.c | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 3de12d1087f..4fa56384cd5 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -845,9 +845,15 @@ int CDECL _isatty(int fd) /* INTERNAL: Allocate stdio file buffer */ static BOOL msvcrt_alloc_buffer(FILE* file) { +#if _MSVCR_VER >= 140 + if((file->_file==STDOUT_FILENO && _isatty(file->_file)) + || file->_file == STDERR_FILENO) + return FALSE; +#else if((file->_file==STDOUT_FILENO || file->_file==STDERR_FILENO) && _isatty(file->_file)) return FALSE; +#endif file->_base = calloc(1, MSVCRT_INTERNAL_BUFSIZ); if(file->_base) { diff --git a/dlls/ucrtbase/tests/file.c b/dlls/ucrtbase/tests/file.c index 4671e641dbe..76233be3fa7 100644 --- a/dlls/ucrtbase/tests/file.c +++ b/dlls/ucrtbase/tests/file.c @@ -55,7 +55,6 @@ static void test_std_stream_buffering(void) if (broken(!GetProcAddress(GetModuleHandleA("ucrtbase"), "__CxxFrameHandler4") && !pos)) trace("stderr is buffered\n"); else - todo_wine ok(pos == 4, "expected stderr to be unbuffered (%d)\n", pos); fflush(stderr);