From patchwork Wed Jan 20 20:14:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 43355 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E229BB6F3E for ; Thu, 21 Jan 2010 07:41:42 +1100 (EST) Received: from localhost ([127.0.0.1]:47104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXhMy-0006Bg-6M for incoming@patchwork.ozlabs.org; Wed, 20 Jan 2010 15:41:40 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXgwu-0003bU-UH for qemu-devel@nongnu.org; Wed, 20 Jan 2010 15:14:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXgwp-0003Sc-H2 for qemu-devel@nongnu.org; Wed, 20 Jan 2010 15:14:43 -0500 Received: from [199.232.76.173] (port=60172 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXgwo-0003Rs-Od for qemu-devel@nongnu.org; Wed, 20 Jan 2010 15:14:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40986) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXgwo-0002f8-At for qemu-devel@nongnu.org; Wed, 20 Jan 2010 15:14:38 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0KKEb4g027412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 20 Jan 2010 15:14:37 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0KKEJUl017611; Wed, 20 Jan 2010 15:14:36 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 20 Jan 2010 21:14:08 +0100 Message-Id: <061fc60f00723c88a83f7f5a4d26d0c964345a2c.1264017981.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: "Kirill A. Shutemov" Subject: [Qemu-devel] [PATCH 12/17] monitor.c: fix warnings with _FORTIFY_SOURCE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Kirill A. Shutemov CC i386-softmmu/monitor.o cc1: warnings being treated as errors /usr/src/RPM/BUILD/qemu-0.11.92/monitor.c: In function 'do_memory_save': /usr/src/RPM/BUILD/qemu-0.11.92/monitor.c:1318: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/monitor.c: In function 'do_physical_memory_save': /usr/src/RPM/BUILD/qemu-0.11.92/monitor.c:1345: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result make[1]: *** [monitor.o] Error 1 Signed-off-by: Kirill A. Shutemov Signed-off-by: Juan Quintela --- monitor.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index cadf422..7fc9973 100644 --- a/monitor.c +++ b/monitor.c @@ -1330,10 +1330,14 @@ static void do_memory_save(Monitor *mon, const QDict *qdict, QObject **ret_data) if (l > size) l = size; cpu_memory_rw_debug(env, addr, buf, l, 0); - fwrite(buf, 1, l, f); + if (fwrite(buf, 1, l, f) != l) { + monitor_printf(mon, "fwrite() error in do_memory_save\n"); + goto exit; + } addr += l; size -= l; } +exit: fclose(f); } @@ -1357,11 +1361,15 @@ static void do_physical_memory_save(Monitor *mon, const QDict *qdict, if (l > size) l = size; cpu_physical_memory_rw(addr, buf, l, 0); - fwrite(buf, 1, l, f); + if (fwrite(buf, 1, l, f) != l) { + monitor_printf(mon, "fwrite() error in do_physical_memory_save\n"); + goto exit; + } fflush(f); addr += l; size -= l; } +exit: fclose(f); }