summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-07-02 18:13:00 (GMT)
committerNico Weber <nicolasweber@gmx.de>2013-07-02 18:13:00 (GMT)
commit1f7fa18dea3a57653811f75072871da08d1cff7b (patch)
tree5e5a80853123138bfffedbddb4ad9e776d15f166 /src
parentda06d2969039ad6a80b4d864fb6c432fef4de47f (diff)
parentad76e867f782e75e0fed620e7b39f7099af154a9 (diff)
downloadNinja-1f7fa18dea3a57653811f75072871da08d1cff7b.zip
Ninja-1f7fa18dea3a57653811f75072871da08d1cff7b.tar.gz
Ninja-1f7fa18dea3a57653811f75072871da08d1cff7b.tar.bz2
Merge pull request #610 from rnk/wstr
Use fwrite to print whatever the subcommand wrote
Diffstat (limited to 'src')
-rw-r--r--src/line_printer.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/line_printer.cc b/src/line_printer.cc
index a75eb05..3537e88 100644
--- a/src/line_printer.cc
+++ b/src/line_printer.cc
@@ -104,6 +104,10 @@ void LinePrinter::Print(string to_print, LineType type) {
void LinePrinter::PrintOnNewLine(const string& to_print) {
if (!have_blank_line_)
printf("\n");
- printf("%s", to_print.c_str());
+ if (!to_print.empty()) {
+ // Avoid printf and C strings, since the actual output might contain null
+ // bytes like UTF-16 does (yuck).
+ fwrite(&to_print[0], sizeof(char), to_print.size(), stdout);
+ }
have_blank_line_ = to_print.empty() || *to_print.rbegin() == '\n';
}