From f48aba6de74e0b21d52257f81521c7841b3e7cc8 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 20 Jan 2010 15:02:59 +0100 Subject: [PATCH] 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 Signed-off-by: Anthony Liguori (cherry picked from commit 1d36e3aae338a71ba449f561b6343bb313f70968) --- block/qcow2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 984264b3ea8..6485d8f2f48 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, -- 2.47.2