summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-08-23 13:59:05 (GMT)
committerNico Weber <nicolasweber@gmx.de>2013-08-23 13:59:05 (GMT)
commita694a746e3cb08ce0d0444c0c32fc1f7f45e6d8a (patch)
tree2f44e36ab8647dcc1cd03d278d7232d12f54ac9f /src
parent23d789b5c8ae60ff1ab4075f69fa7a3e80f72c32 (diff)
parent0402cab0776e0bf3db5705fd02f0f860a4e1864c (diff)
downloadNinja-a694a746e3cb08ce0d0444c0c32fc1f7f45e6d8a.zip
Ninja-a694a746e3cb08ce0d0444c0c32fc1f7f45e6d8a.tar.gz
Ninja-a694a746e3cb08ce0d0444c0c32fc1f7f45e6d8a.tar.bz2
Merge pull request #628 from rnk/wstr
Use fwrite in the msvc tool instead of printf
Diffstat (limited to 'src')
-rw-r--r--src/msvc_helper_main-win32.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/msvc_helper_main-win32.cc b/src/msvc_helper_main-win32.cc
index 8a0479c..e3a7846 100644
--- a/src/msvc_helper_main-win32.cc
+++ b/src/msvc_helper_main-win32.cc
@@ -126,10 +126,15 @@ int MSVCHelperMain(int argc, char** argv) {
WriteDepFileOrDie(output_filename, parser);
}
+ if (output.empty())
+ return exit_code;
+
// CLWrapper's output already as \r\n line endings, make sure the C runtime
// doesn't expand this to \r\r\n.
_setmode(_fileno(stdout), _O_BINARY);
- printf("%s", output.c_str());
+ // Avoid printf and C strings, since the actual output might contain null
+ // bytes like UTF-16 does (yuck).
+ fwrite(&output[0], 1, output.size(), stdout);
return exit_code;
}