From 76a2a30a99c670e9ec1b4a5d976868059c6bc258 Mon Sep 17 00:00:00 2001 From: Pavel Butsykin Date: Fri, 29 Sep 2017 15:16:12 +0300 Subject: qcow2: fix return error code in qcow2_truncate() Signed-off-by: Pavel Butsykin Reviewed-by: Eric Blake Reviewed-by: John Snow Reviewed-by: Max Reitz Message-id: 20170929121613.25997-2-pbutsykin@virtuozzo.com Signed-off-by: Max Reitz --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'block') diff --git a/block/qcow2.c b/block/qcow2.c index 33597394b5..960b3ab977 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3167,7 +3167,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, @@ -3196,7 +3196,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, -- cgit v1.2.3