diff options
-rw-r--r-- | src/build_log.cc | 1 | ||||
-rw-r--r-- | src/disk_interface.cc | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/build_log.cc b/src/build_log.cc index 4b93931..fd93ea8 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -221,6 +221,7 @@ bool BuildLog::Recompact(const string& path, string* err) { if (fprintf(f, kFileSignature, kCurrentVersion) < 0) { *err = strerror(errno); + fclose(f); return false; } diff --git a/src/disk_interface.cc b/src/disk_interface.cc index b1a1746..5a36685 100644 --- a/src/disk_interface.cc +++ b/src/disk_interface.cc @@ -109,9 +109,10 @@ bool RealDiskInterface::WriteFile(const string & path, const string & contents) Error("WriteFile(%s): Unable to create file. %s", path.c_str(), strerror(errno)); return false; } - + if (fwrite(contents.data(), 1, contents.length(), fp) < contents.length()) { Error("WriteFile(%s): Unable to write to the file. %s", path.c_str(), strerror(errno)); + fclose(fp); return false; } |