aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-01-20 15:02:59 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-27 07:51:10 -0600
commitf48aba6de74e0b21d52257f81521c7841b3e7cc8 (patch)
treeb514f00baa2f55e1ab931de56eb1f6e359381cd5 /block
parentcb2ae96bf6bfb50d5002578d14da6d84ebc5ecb2 (diff)
qcow2: Fix error handling in qcow_save_vmstate
Don't assume success but pass the bdrv_pwrite return value on. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 1d36e3aae338a71ba449f561b6343bb313f70968)
Diffstat (limited to 'block')
-rw-r--r--block/qcow2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index 984264b3ea..6485d8f2f4 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1056,12 +1056,13 @@ static int qcow_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
{
BDRVQcowState *s = bs->opaque;
int growable = bs->growable;
+ int ret;
bs->growable = 1;
- bdrv_pwrite(bs, qcow_vm_state_offset(s) + pos, buf, size);
+ ret = bdrv_pwrite(bs, qcow_vm_state_offset(s) + pos, buf, size);
bs->growable = growable;
- return size;
+ return ret;
}
static int qcow_load_vmstate(BlockDriverState *bs, uint8_t *buf,