block/qcow2-threads: fix qcow2_decompress
commite7266570f2cf7b3ca2a156c677ee0a59d563458b
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Mon, 2 Mar 2020 15:09:30 +0000 (2 18:09 +0300)
committerMax Reitz <mreitz@redhat.com>
Wed, 11 Mar 2020 11:42:30 +0000 (11 12:42 +0100)
treeb8499e404f1b78b8880016346201c76550db8e84
parentfc124ea1dbfac2a1d5b851596831c9da746b7b66
block/qcow2-threads: fix qcow2_decompress

On success path we return what inflate() returns instead of 0. And it
most probably works for Z_STREAM_END as it is positive, but is
definitely broken for Z_BUF_ERROR.

While being here, switch to errno return code, to be closer to
qcow2_compress API (and usual expectations).

Revert condition in if to be more positive. Drop dead initialization of
ret.

Cc: qemu-stable@nongnu.org # v4.0
Fixes: 341926ab83e2b
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200302150930.16218-1-vsementsov@virtuozzo.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2-threads.c