From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9UPP-0005Na-0A for qemu-devel@nongnu.org; Tue, 31 Oct 2017 07:08:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9UPK-0007eD-Po for qemu-devel@nongnu.org; Tue, 31 Oct 2017 07:08:38 -0400 Received: from mail.ispras.ru ([83.149.199.45]:42432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9UPK-0007do-IS for qemu-devel@nongnu.org; Tue, 31 Oct 2017 07:08:34 -0400 From: Pavel Dovgalyuk Date: Tue, 31 Oct 2017 14:08:34 +0300 Message-ID: <20171031110834.5836.24202.stgit@pasha-VirtualBox> In-Reply-To: <20171031110641.5836.43266.stgit@pasha-VirtualBox> References: <20171031110641.5836.43266.stgit@pasha-VirtualBox> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH 21/26] replay: check return values of fwrite List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: dovgaluk@ispras.ru This patch adds error reporting when fwrite cannot completely save the buffer to the file. Signed-off-by: Pavel Dovgalyuk --- replay/replay-internal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/replay/replay-internal.c b/replay/replay-internal.c index d036a02..0f73fdc 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -62,7 +62,9 @@ void replay_put_array(const uint8_t *buf, size_t size) { if (replay_file) { replay_put_dword(size); - fwrite(buf, 1, size, replay_file); + if (fwrite(buf, 1, size, replay_file) != size) { + error_report("replay write error"); + } } }