Commit ae5475e8 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

qcow2: Fix qcow2_truncate() error return value



If qcow2_alloc_clusters_at() returns an error, we do need to negate it
to get back the positive errno code for error_setg_errno(), but we still
need to return the negative error code.

Fixes: 772d1f97
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 7c895269
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3597,7 +3597,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
        if (clusters_allocated < 0) {
            error_setg_errno(errp, -clusters_allocated,
                             "Failed to allocate data clusters");
            return -clusters_allocated;
            return clusters_allocated;
        }

        assert(clusters_allocated == nb_new_data_clusters);