From 65e1fb9496aeb66e5087614aa535b05eb818eb36 Mon Sep 17 00:00:00 2001 From: mgroeber9110 Date: Mon, 1 Jan 2024 21:09:10 +0100 Subject: [PATCH] Fix bug in tools implementation of sprintf() on win32 that occasionally makes it replace \n by \r\n as if it were in text mode. --- Tools/utils/printf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/utils/printf.c b/Tools/utils/printf.c index 16b132ef6..97e69118f 100644 --- a/Tools/utils/printf.c +++ b/Tools/utils/printf.c @@ -675,9 +675,9 @@ i_vfprintf(FILE *stream, /* Where to output formatted results. */ * automatically. */ #if defined(__HIGHC__) || defined(_MSC_VER) || defined(__WATCOMC__) - if ((c == '\n') && (stream->_flag & _O_BINARY)) { + if (isstrm && (c == '\n') && (stream->_flag & _O_BINARY)) { #else - if ((c == '\n') && (stream->flags & _F_BIN)) { + if (isstrm && (c == '\n') && (stream->flags & _F_BIN)) { #endif i_putc('\r', stream); }