Received: from eggs.gnu.org ([2001:4830:134:3::10]:60433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzQVD-00020E-7h for qemu-devel@nongnu.org; Tue, 24 Jun 2014 09:11:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzQV5-0003Tx-DO for qemu-devel@nongnu.org; Tue, 24 Jun 2014 09:11:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzQV5-0003Te-4M for qemu-devel@nongnu.org; Tue, 24 Jun 2014 09:11:03 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5ODB1Kr031533 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 24 Jun 2014 09:11:02 -0400 From: Juan Quintela Date: Tue, 24 Jun 2014 15:10:11 +0200 Message-Id: <1403615412-6794-22-git-send-email-quintela@redhat.com> In-Reply-To: <1403615412-6794-1-git-send-email-quintela@redhat.com> References: <1403615412-6794-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PULL 21/22] 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 Reviewed-by: Dr. David Alan Gilbert --- 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