[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/43] qemu-img: Check create_opts before image amen
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 07/43] qemu-img: Check create_opts before image amendment |
Date: |
Tue, 24 Feb 2015 15:47:42 -0600 |
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>
(cherry picked from commit b2439d26f078c826e5e06b34d978a6f6d5c7c56f)
Signed-off-by: Michael Roth <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.9.1
- [Qemu-devel] [PATCH 38/43] qemu-thread: fix qemu_event without futexes, (continued)
- [Qemu-devel] [PATCH 38/43] qemu-thread: fix qemu_event without futexes, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 40/43] fix mc146818rtc wrong subsection name to avoid vmstate_subsection_load() fail, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 03/43] block/vvfat: qcow driver may not be found, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 43/43] exec: change default exception_index value for migration to -1, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 41/43] block/iscsi: fix uninitialized variable, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 42/43] qtest: Fix deadloop by running main loop AIO context's timers, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 06/43] qemu-img: Check create_opts before image creation, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 04/43] block/nfs: Add create_opts, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 08/43] iotests: Only kill NBD server if it runs, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 05/43] block: Check create_opts before image creation, Michael Roth, 2015/02/24
- [Qemu-devel] [PATCH 07/43] qemu-img: Check create_opts before image amendment,
Michael Roth <=
- Re: [Qemu-devel] [Qemu-stable] Patch Round-up for stable 2.2.1, freeze on 2015-03-05, Gonglei (Arei), 2015/02/24
- Re: [Qemu-devel] Patch Round-up for stable 2.2.1, freeze on 2015-03-05, Leon Alrae, 2015/02/25