From 48abc06049e94aff594cd22adb6899313e67e38a Mon Sep 17 00:00:00 2001 From: Mayank Agarwal Date: Thu, 14 Mar 2013 18:12:22 -0700 Subject: [PATCH] Using return value of fwrite in posix_logger.h Summary: Was causing error(warning) in third-party saying unused result Test Plan: make Reviewers: sheki, dhruba Reviewed By: dhruba Differential Revision: https://reviews.facebook.net/D9447 --- util/posix_logger.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/util/posix_logger.h b/util/posix_logger.h index b1fbfd97f..ac6615e97 100644 --- a/util/posix_logger.h +++ b/util/posix_logger.h @@ -111,11 +111,12 @@ class PosixLogger : public Logger { } #endif - fwrite(base, 1, write_size, file_); - fflush(file_); - - log_size_ += write_size; - + size_t sz = fwrite(base, 1, write_size, file_); + assert(sz == write_size); + if (sz > 0) { + fflush(file_); + log_size_ += write_size; + } if (base != buffer) { delete[] base; }