Received: from eggs.gnu.org ([2001:4830:134:3::10]:37696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxuE3-0008Hd-Ib for qemu-devel@nongnu.org; Fri, 29 Sep 2017 08:17:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxuE2-0008Tz-Iz for qemu-devel@nongnu.org; Fri, 29 Sep 2017 08:17:03 -0400 From: Pavel Butsykin Date: Fri, 29 Sep 2017 15:16:12 +0300 Message-Id: <20170929121613.25997-2-pbutsykin@virtuozzo.com> In-Reply-To: <20170929121613.25997-1-pbutsykin@virtuozzo.com> References: <20170929121613.25997-1-pbutsykin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v4 1/2] qcow2: fix return error code in qcow2_truncate() List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: pbutsykin@virtuozzo.com, kwolf@redhat.com, mreitz@redhat.com, eblake@redhat.com, jsnow@redhat.com, den@openvz.org List-ID: Signed-off-by: Pavel Butsykin Reviewed-by: Eric Blake Reviewed-by: John Snow Reviewed-by: Max Reitz --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 2174a84d1f..8a4311d338 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3166,7 +3166,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, if (old_file_size < 0) { error_setg_errno(errp, -old_file_size, "Failed to inquire current file length"); - return ret; + return old_file_size; } nb_new_data_clusters = DIV_ROUND_UP(offset - old_length, @@ -3195,7 +3195,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset, if (allocation_start < 0) { error_setg_errno(errp, -allocation_start, "Failed to resize refcount structures"); - return -allocation_start; + return allocation_start; } clusters_allocated = qcow2_alloc_clusters_at(bs, allocation_start, -- 2.14.1