diff options
Diffstat (limited to 'third_party/ijar/platform_utils.cc')
-rw-r--r-- | third_party/ijar/platform_utils.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/third_party/ijar/platform_utils.cc b/third_party/ijar/platform_utils.cc index ce6fb54bd2..e1b46db5b5 100644 --- a/third_party/ijar/platform_utils.cc +++ b/third_party/ijar/platform_utils.cc @@ -95,7 +95,9 @@ bool write_file(const char* path, mode_t perm, const void* data, size_t size) { return false; } bool result = true; - if (write(fd, data, size) != size) { + int error = write(fd, data, size); + // Check for an error condition, or if we didn't write all of the data. + if (error < 0 || static_cast<size_t>(error) != size) { fprintf(stderr, "Cannot write %zu bytes to file %s: %s\n", size, path, strerror(errno)); result = false; |