diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2020-11-28 11:22:23 (GMT) |
---|---|---|
committer | Jan Niklas Hasse <jhasse@bixense.com> | 2020-11-28 11:22:23 (GMT) |
commit | 9cf70a20685ac3bd48fceac2ea268d449c7e78d5 (patch) | |
tree | 433402b91ee03f5a476da5c0bdb26f6d3bad7809 /src/build_log.cc | |
parent | a1f879b29c9aafe6a2bc0ba885701f8f4f19f772 (diff) | |
parent | ed056bdd8c8d578a9952bd93b76f29c14199c85b (diff) | |
download | Ninja-9cf70a20685ac3bd48fceac2ea268d449c7e78d5.zip Ninja-9cf70a20685ac3bd48fceac2ea268d449c7e78d5.tar.gz Ninja-9cf70a20685ac3bd48fceac2ea268d449c7e78d5.tar.bz2 |
Merge branch 'master' into release
Diffstat (limited to 'src/build_log.cc')
-rw-r--r-- | src/build_log.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/build_log.cc b/src/build_log.cc index e5f179c..4dcd6ce 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -41,6 +41,8 @@ #define strtoll _strtoi64 #endif +using namespace std; + // Implementation details: // Each run's log appends to the log file. // To load, we run through all log entries in series, throwing away @@ -181,14 +183,16 @@ void BuildLog::Close() { } bool BuildLog::OpenForWriteIfNeeded() { - if (log_file_path_.empty()) { + if (log_file_ || log_file_path_.empty()) { return true; } log_file_ = fopen(log_file_path_.c_str(), "ab"); if (!log_file_) { return false; } - setvbuf(log_file_, NULL, _IOLBF, BUFSIZ); + if (setvbuf(log_file_, NULL, _IOLBF, BUFSIZ) != 0) { + return false; + } SetCloseOnExec(fileno(log_file_)); // Opening a file in append mode doesn't set the file pointer to the file's @@ -200,7 +204,6 @@ bool BuildLog::OpenForWriteIfNeeded() { return false; } } - log_file_path_.clear(); return true; } |