diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-04-07 16:52:34 +0200 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 20:03:49 -0600 |
commit | 53f408df411c02184ac1828d48c0e89719a439d4 (patch) | |
tree | 2ed5819d4e5ea9eb81493395058409e671313a28 /block | |
parent | 085e580b4b2dca0c89f452ece3fe26a2b426217f (diff) | |
download | hqemu-53f408df411c02184ac1828d48c0e89719a439d4.zip hqemu-53f408df411c02184ac1828d48c0e89719a439d4.tar.gz |
vpc: fix return value check for blk_pwrite
bdrv_pwrite_sync used to return zero or negative error, while blk_pwrite returns
the number of written bytes when successful. This caused VPC image creation
to fail spectacularly: it wrote the first 512 bytes, and then exited immediately
because of the non-zero answer from blk_pwrite. But the truly spectacular part
is that it returns a positive value (the 512 that blk_pwrite returned) causing
everyone to believe that it succeeded.
This fixes qemu-iotests with vpc format.
Fixes: b8f45cdf7827e39f9a1e6cc446f5972cc6144237
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/vpc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/vpc.c b/block/vpc.c index 8830b5b..3713ec3 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -775,7 +775,7 @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t *buf, num_bat_entries = (total_sectors + block_size / 512) / (block_size / 512); ret = blk_pwrite(blk, offset, buf, HEADER_SIZE); - if (ret) { + if (ret < 0) { goto fail; } |