From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwTgR-0007Yr-1G for qemu-devel@nongnu.org; Mon, 16 Jun 2014 05:58:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwTgK-0002B0-U1 for qemu-devel@nongnu.org; Mon, 16 Jun 2014 05:58:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwTgK-0002Av-M8 for qemu-devel@nongnu.org; Mon, 16 Jun 2014 05:58:28 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5G9wRlL024998 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 16 Jun 2014 05:58:28 -0400 From: Juan Quintela Date: Mon, 16 Jun 2014 11:57:58 +0200 Message-Id: <1402912703-28195-3-git-send-email-quintela@redhat.com> In-Reply-To: <1402912703-28195-1-git-send-email-quintela@redhat.com> References: <1402912703-28195-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 02/27] vmstate: Return error in case of error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vmstate.c b/vmstate.c index b5882fa..c996520 100644 --- a/vmstate.c +++ b/vmstate.c @@ -98,7 +98,11 @@ 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) { + qemu_file_set_error(f, ret); trace_vmstate_load_field_error(field->name, ret); return ret; } -- 1.9.3