[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 57/73] qemu-img: Check create_opts before image amend
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 57/73] qemu-img: Check create_opts before image amendment |
Date: |
Wed, 10 Dec 2014 11:34:23 +0100 |
From: Max Reitz <address@hidden>
The image options which can be amended are described by the .create_opts
field for every driver. This field must therefore be non-NULL so that
anything can be amended in the first place. Check that this holds true
before going into qemu_opts_create() (because if .create_opts is NULL,
the create_opts pointer in img_amend() will be NULL after
qemu_opts_append()).
Cc: address@hidden
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-img.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/qemu-img.c b/qemu-img.c
index 8c4edf3..7876258 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2986,6 +2986,13 @@ static int img_amend(int argc, char **argv)
goto out;
}
+ if (!bs->drv->create_opts) {
+ error_report("Format driver '%s' does not support any options to
amend",
+ fmt);
+ ret = -1;
+ goto out;
+ }
+
create_opts = qemu_opts_append(create_opts, bs->drv->create_opts);
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
if (options && qemu_opts_do_parse(opts, options, NULL)) {
--
1.8.3.1
- [Qemu-devel] [PULL 45/73] block: do not use get_clock(), (continued)
- [Qemu-devel] [PULL 45/73] block: do not use get_clock(), Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 48/73] nvme: 64kB page size fixes, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 47/73] qemu-iotests: 082: Filter the real disk size, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 49/73] ide: Check validity of logical block size, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 52/73] block: Omit bdrv_find_format for essential drivers, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 50/73] iotests: Specify qcow2 format for qemu-io in 059, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 51/73] block: Make essential BlockDriver objects public, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 53/73] block/vvfat: qcow driver may not be found, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 54/73] block/nfs: Add create_opts, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 56/73] qemu-img: Check create_opts before image creation, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 57/73] qemu-img: Check create_opts before image amendment,
Kevin Wolf <=
- [Qemu-devel] [PULL 55/73] block: Check create_opts before image creation, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 58/73] iotests: Only kill NBD server if it runs, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 60/73] qcow2: Prevent numerical overflow, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 62/73] qcow2: Respect bdrv_truncate() error, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 61/73] qcow2: Flushing the caches in qcow2_close may fail, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 65/73] block: remove BLOCK_OPT_NOCOW from vdi_create_opts, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 63/73] block/raw-posix: Fix ret in raw_open_common(), Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 66/73] block: remove BLOCK_OPT_NOCOW from vpc_create_opts, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 68/73] vmdk: Use g_random_int to generate CID, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 69/73] vmdk: Fix comment to match code of extent lines, Kevin Wolf, 2014/12/10