[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 05/12] qemu-img: Check create_opts before image cre
From: |
Max Reitz |
Subject: |
[Qemu-stable] [PATCH 05/12] qemu-img: Check create_opts before image creation |
Date: |
Tue, 25 Nov 2014 15:07:58 +0100 |
If a driver supports image creation, it needs to set the .create_opts
field. We can use that to make sure .create_opts for both drivers
involved is not NULL for the target image in qemu-img convert, which is
important so that the create_opts pointer in img_convert() is not NULL
after the qemu_opts_append() calls and when going into
qemu_opts_create().
Cc: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
qemu-img.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/qemu-img.c b/qemu-img.c
index a42335c..8c4edf3 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1531,6 +1531,20 @@ static int img_convert(int argc, char **argv)
goto out;
}
+ if (!drv->create_opts) {
+ error_report("Format driver '%s' does not support image creation",
+ drv->format_name);
+ ret = -1;
+ goto out;
+ }
+
+ if (!proto_drv->create_opts) {
+ error_report("Protocol driver '%s' does not support image creation",
+ proto_drv->format_name);
+ ret = -1;
+ goto out;
+ }
+
create_opts = qemu_opts_append(create_opts, drv->create_opts);
create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
--
1.9.3
- Re: [Qemu-stable] [Qemu-devel] [PATCH 01/12] block: qcow2 driver may not be found, (continued)
- Re: [Qemu-stable] [Qemu-devel] [PATCH 01/12] block: qcow2 driver may not be found, Max Reitz, 2014/11/26
- Re: [Qemu-stable] [Qemu-devel] [PATCH 01/12] block: qcow2 driver may not be found, Eric Blake, 2014/11/26
- Re: [Qemu-stable] [Qemu-devel] [PATCH 01/12] block: qcow2 driver may not be found, Max Reitz, 2014/11/26
- Re: [Qemu-stable] [Qemu-devel] [PATCH 01/12] block: qcow2 driver may not be found, Kevin Wolf, 2014/11/26
- Re: [Qemu-stable] [Qemu-devel] [PATCH 01/12] block: qcow2 driver may not be found, Markus Armbruster, 2014/11/27
[Qemu-stable] [PATCH 03/12] block/nfs: Add create_opts, Max Reitz, 2014/11/25
[Qemu-stable] [PATCH 04/12] block: Check create_opts before image creation, Max Reitz, 2014/11/25
[Qemu-stable] [PATCH 05/12] qemu-img: Check create_opts before image creation,
Max Reitz <=
[Qemu-stable] [PATCH 06/12] qemu-img: Check create_opts before image amendment, Max Reitz, 2014/11/25
[Qemu-stable] [PATCH 08/12] iotests: Add test for unsupported image creation, Max Reitz, 2014/11/25
[Qemu-stable] [PATCH 07/12] iotests: Only kill NBD server if it runs, Max Reitz, 2014/11/25
[Qemu-stable] [PATCH 09/12] qcow2: Prevent numerical overflow, Max Reitz, 2014/11/25
[Qemu-stable] [PATCH 10/12] qcow2: Flushing the caches in qcow2_close may fail, Max Reitz, 2014/11/25
[Qemu-stable] [PATCH 12/12] block/raw-posix: Fix ret in raw_open_common(), Max Reitz, 2014/11/25
[Qemu-stable] [PATCH 11/12] qcow2: Respect bdrv_truncate() error, Max Reitz, 2014/11/25