diff options
author | Kevin Wolf <kwolf@redhat.com> | 2010-01-20 15:03:03 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-01-27 07:52:12 -0600 |
commit | 29bb3bf35037079c2dc3a67f7ba25c8011b40c6c (patch) | |
tree | 66b4b5241888ed89892151637a7c6acda507e9ff /block | |
parent | block: Return original error codes in bdrv_pread/write (diff) | |
download | qemu-kvm-29bb3bf35037079c2dc3a67f7ba25c8011b40c6c.tar.gz qemu-kvm-29bb3bf35037079c2dc3a67f7ba25c8011b40c6c.tar.bz2 qemu-kvm-29bb3bf35037079c2dc3a67f7ba25c8011b40c6c.zip |
qcow2: Fix error handling in grow_refcount_table
Return the appropriate error code instead of -EIO.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit f2b7c8b37045e0e030ef027cfb6d574558fb732a)
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2-refcount.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 54b19f86d..9fb28383c 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -168,9 +168,12 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size) cpu_to_be64w((uint64_t*)data, table_offset); cpu_to_be32w((uint32_t*)(data + 8), refcount_table_clusters); - if (bdrv_pwrite(s->hd, offsetof(QCowHeader, refcount_table_offset), - data, sizeof(data)) != sizeof(data)) + ret = bdrv_pwrite(s->hd, offsetof(QCowHeader, refcount_table_offset), + data, sizeof(data)); + if (ret != sizeof(data)) { goto fail; + } + qemu_free(s->refcount_table); old_table_offset = s->refcount_table_offset; old_table_size = s->refcount_table_size; @@ -183,7 +186,7 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size) return 0; fail: qemu_free(new_table); - return -EIO; + return ret < 0 ? ret : -EIO; } |