diff options
Diffstat (limited to 'src/deps_log.cc')
-rw-r--r-- | src/deps_log.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/deps_log.cc b/src/deps_log.cc index 1fb65ae..191f300 100644 --- a/src/deps_log.cc +++ b/src/deps_log.cc @@ -30,6 +30,8 @@ typedef unsigned __int32 uint32_t; #include "state.h" #include "util.h" +using namespace std; + // The version is stored as 4 bytes after the signature and also serves as a // byte order mark. Signature and version combined are 16 bytes long. const char kFileSignature[] = "# ninjadeps\n"; @@ -411,7 +413,9 @@ bool DepsLog::OpenForWriteIfNeeded() { } // Set the buffer size to this and flush the file buffer after every record // to make sure records aren't written partially. - setvbuf(file_, NULL, _IOFBF, kMaxRecordSize + 1); + if (setvbuf(file_, NULL, _IOFBF, kMaxRecordSize + 1) != 0) { + return false; + } SetCloseOnExec(fileno(file_)); // Opening a file in append mode doesn't set the file pointer to the file's |