block/vhdx: check error return of bdrv_truncate()

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Jeff Cody 2017-08-07 08:38:22 -04:00 committed by Kevin Wolf
parent c6572fa0d2
commit 95d729835f
1 changed files with 5 additions and 1 deletions

View File

@ -558,7 +558,11 @@ static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s,
ret = -EINVAL;
goto exit;
}
bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF, NULL);
ret = bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF,
NULL);
if (ret < 0) {
goto exit;
}
}
}
qemu_vfree(desc_entries);