From patchwork Tue Aug 18 13:34:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 31558 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 7B847B6F2B for ; Tue, 18 Aug 2009 23:41:58 +1000 (EST) Received: from localhost ([127.0.0.1]:39688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdOwl-00072y-Gp for incoming@patchwork.ozlabs.org; Tue, 18 Aug 2009 09:41:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdOra-0005UD-D8 for qemu-devel@nongnu.org; Tue, 18 Aug 2009 09:36:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdOrV-0005T5-MC for qemu-devel@nongnu.org; Tue, 18 Aug 2009 09:36:33 -0400 Received: from [199.232.76.173] (port=55923 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdOrV-0005T2-HC for qemu-devel@nongnu.org; Tue, 18 Aug 2009 09:36:29 -0400 Received: from mx2.redhat.com ([66.187.237.31]:43653) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MdOrU-0001ty-Sf for qemu-devel@nongnu.org; Tue, 18 Aug 2009 09:36:29 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7IDaShx000545 for ; Tue, 18 Aug 2009 09:36:28 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7IDaQ8J018958; Tue, 18 Aug 2009 09:36:27 -0400 Received: from localhost.localdomain (vpn1-4-110.ams2.redhat.com [10.36.4.110]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7IDaKSw006375; Tue, 18 Aug 2009 09:36:25 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 18 Aug 2009 15:34:08 +0200 Message-Id: <362c8a9927d32b023a3a18394003d095c9fe0095.1250601335.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [Qemu-devel] [PATCH 3/5] Don't ignore load_state() error return values. 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 An error value here means that some device was not able to load it state. There is no hope at this point. Signed-off-by: Juan Quintela --- savevm.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/savevm.c b/savevm.c index 7779c0e..55a1b50 100644 --- a/savevm.c +++ b/savevm.c @@ -955,7 +955,13 @@ int qemu_loadvm_state(QEMUFile *f) le->next = first_le; first_le = le; - le->se->load_state(f, le->se->opaque, le->version_id); + ret = le->se->load_state(f, le->se->opaque, le->version_id); + if (ret < 0) { + fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n", + instance_id, idstr); + ret = -EINVAL; + goto out; + } break; case QEMU_VM_SECTION_PART: case QEMU_VM_SECTION_END: @@ -968,7 +974,13 @@ int qemu_loadvm_state(QEMUFile *f) goto out; } - le->se->load_state(f, le->se->opaque, le->version_id); + ret = le->se->load_state(f, le->se->opaque, le->version_id); + if (ret != 0) { + fprintf(stderr, "qemu: warning: error while loading state section '%d'\n", + section_id); + ret = -EINVAL; + goto out; + } break; default: fprintf(stderr, "Unknown savevm section type %d\n", section_type);