From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=43000 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTbar-0004DW-AJ for qemu-devel@nongnu.org; Fri, 17 Dec 2010 09:47:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTbaq-0003dC-2O for qemu-devel@nongnu.org; Fri, 17 Dec 2010 09:47:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTbap-0003cz-RY for qemu-devel@nongnu.org; Fri, 17 Dec 2010 09:47:36 -0500 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.13.8/8.13.8) with ESMTP id oBHElYAt026348 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Dec 2010 09:47:34 -0500 Message-ID: <4D0B7804.2020504@redhat.com> Date: Fri, 17 Dec 2010 15:47:32 +0100 From: Jes Sorensen MIME-Version: 1.0 References: <1292515532-24198-1-git-send-email-Jes.Sorensen@redhat.com> <1292515532-24198-3-git-send-email-Jes.Sorensen@redhat.com> <4D0B7343.3080609@redhat.com> In-Reply-To: <4D0B7343.3080609@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/2] Add proper -errno error return values to qcow2_open() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On 12/17/10 15:27, Kevin Wolf wrote: > Am 16.12.2010 17:05, schrieb Jes.Sorensen@redhat.com: >> From: Jes Sorensen >> >> In addition this adds missing braces to the function to be consistent >> with the coding style. >> >> Signed-off-by: Jes Sorensen >> --- >> block/qcow2.c | 61 ++++++++++++++++++++++++++++++++++++++++---------------- >> 1 files changed, 43 insertions(+), 18 deletions(-) >> >> diff --git a/block/qcow2.c b/block/qcow2.c >> index d7fd167..b4a9e5e 100644 >> --- a/block/qcow2.c >> +++ b/block/qcow2.c >> @@ -140,12 +140,14 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset, >> static int qcow2_open(BlockDriverState *bs, int flags) >> { >> BDRVQcowState *s = bs->opaque; >> - int len, i; >> + int len, i, ret = 0; >> QCowHeader header; >> uint64_t ext_end; >> >> - if (bdrv_pread(bs->file, 0, &header, sizeof(header)) != sizeof(header)) >> + if (bdrv_pread(bs->file, 0, &header, sizeof(header)) != sizeof(header)) { >> + ret = -EIO; >> goto fail; >> + } > > ret = bdrv_pread(...); > if (ret < 0) { > goto fail; > } Hmmm I must have confused something and looked at a wrong pread function where it just returned -1 on error. I'll fix it. Thanks, Jes