summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/build_log.cc2
-rw-r--r--src/ninja.cc10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/build_log.cc b/src/build_log.cc
index 06db0e6..ba09b46 100644
--- a/src/build_log.cc
+++ b/src/build_log.cc
@@ -52,6 +52,8 @@ void BuildLog::Close() {
bool BuildLog::Load(const string& path, string* err) {
FILE* file = fopen(path.c_str(), "r");
if (!file) {
+ if (errno == ENOENT)
+ return true;
*err = strerror(errno);
return false;
}
diff --git a/src/ninja.cc b/src/ninja.cc
index f88e2b9..a39ff5c 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -90,9 +90,17 @@ int main(int argc, char** argv) {
return 0;
}
+ const char* kLogPath = "ninja_log";
BuildLog log;
- if (!log.OpenForWrite("ninja_log", &err))
+ if (!log.Load(kLogPath, &err)) {
+ fprintf(stderr, "error loading build log: %s\n", err.c_str());
return 1;
+ }
+
+ if (!log.OpenForWrite(kLogPath, &err)) {
+ fprintf(stderr, "error opening build log: %s\n", err.c_str());
+ return 1;
+ }
config.build_log = &log;
Builder builder(&state, config);