diff options
Diffstat (limited to 'block/raw-format.c')
-rw-r--r-- | block/raw-format.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/block/raw-format.c b/block/raw-format.c index 86fbc657eb..36e65036f0 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -327,21 +327,23 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp) } } -static int raw_truncate(BlockDriverState *bs, int64_t offset) +static int raw_truncate(BlockDriverState *bs, int64_t offset, Error **errp) { BDRVRawState *s = bs->opaque; if (s->has_size) { + error_setg(errp, "Cannot resize fixed-size raw disks"); return -ENOTSUP; } if (INT64_MAX - offset < s->offset) { + error_setg(errp, "Disk size too large for the chosen offset"); return -EINVAL; } s->size = offset; offset += s->offset; - return bdrv_truncate(bs->file, offset); + return bdrv_truncate(bs->file, offset, errp); } static int raw_media_changed(BlockDriverState *bs) |