From patchwork Mon Apr 21 14:39:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 341081 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C7FE0140078 for ; Tue, 22 Apr 2014 13:18:25 +1000 (EST) Received: from localhost ([::1]:49233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcFUc-0001jr-Em for incoming@patchwork.ozlabs.org; Mon, 21 Apr 2014 10:46:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcFQ5-00031j-FK for qemu-devel@nongnu.org; Mon, 21 Apr 2014 10:42:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WcFPx-0003s8-IZ for qemu-devel@nongnu.org; Mon, 21 Apr 2014 10:42:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21915) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WcFPx-0003s4-An for qemu-devel@nongnu.org; Mon, 21 Apr 2014 10:41:57 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3LEfuUN015148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 21 Apr 2014 10:41:56 -0400 Received: from trasno.mitica (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3LEfi6D019220; Mon, 21 Apr 2014 10:41:55 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 21 Apr 2014 16:39:47 +0200 Message-Id: <1398091304-10677-8-git-send-email-quintela@redhat.com> In-Reply-To: <1398091304-10677-1-git-send-email-quintela@redhat.com> References: <1398091304-10677-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 007/124] vmstate: Return error in case of error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If there is an error while loading a field, we should stop reading and not continue with the rest of fields. And we should also set an error in qemu_file. Signed-off-by: Juan Quintela --- vmstate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vmstate.c b/vmstate.c index bfa34cc..bcf1cde 100644 --- a/vmstate.c +++ b/vmstate.c @@ -74,7 +74,13 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, ret = field->info->get(f, addr, size); } + if (ret >= 0) { + ret = qemu_file_get_error(f); + } if (ret < 0) { + if (!qemu_file_get_error(f)) { + qemu_file_set_error(f, ret); + } trace_vmstate_load_field_error(field->name, ret); return ret; }