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
This commit is contained in:
NAKAMURA Takumi 2014-01-12 16:14:24 +00:00
parent f9f10e3f95
commit 25ca9f9ef1

View File

@ -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