From 25ca9f9ef10c26181a7c0e8dea2f26554c722efc Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 12 Jan 2014 16:14:24 +0000 Subject: [PATCH] raw_fd_ostream: Don't change STDERR to O_BINARY, or w*printf() (in assert()) would barf wide chars after llvm::errs(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199057 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/raw_ostream.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 84f5ab592e6..2d825e15091 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -469,9 +469,10 @@ raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered) : raw_ostream(unbuffered), FD(fd), ShouldClose(shouldClose), Error(false), UseAtomicWrites(false) { #ifdef O_BINARY - // Setting STDOUT and STDERR to binary mode is necessary in Win32 + // Setting STDOUT to binary mode is necessary in Win32 // to avoid undesirable linefeed conversion. - if (fd == STDOUT_FILENO || fd == STDERR_FILENO) + // Don't touch STDERR, or w*printf() (in assert()) would barf wide chars. + if (fd == STDOUT_FILENO) setmode(fd, O_BINARY); #endif