raw_fd_ostream: Don't change STDERR to O_BINARY, or w*printf() (in assert()) would...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 12 Jan 2014 16:14:24 +0000 (16:14 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 12 Jan 2014 16:14:24 +0000 (16:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199057 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/raw_ostream.cpp

index 84f5ab592e63701084b19ac668b5dea50edc5c28..2d825e1509143440ec6b3dc4114eaaa8d7fb152d 100644 (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