diff options
Diffstat (limited to 'src/disk_interface.cc')
-rw-r--r-- | src/disk_interface.cc | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |