qcow2: Fix error handling in qcow_save_vmstate
authorKevin Wolf <kwolf@redhat.com>
Wed, 20 Jan 2010 14:02:59 +0000 (15:02 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 26 Jan 2010 20:59:19 +0000 (14:59 -0600)
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>
block/qcow2.c

index 6622ebadb0d7dac219f9cc17a0a80346b21119e8..e06f4dd3c1e05d8fefa406f206568bab66a78fe8 100644 (file)
@@ -1163,12 +1163,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,