[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 20/46] block: Avoid error accumulation in bdrv_img_create()
From: |
Markus Armbruster |
Subject: |
[PATCH 20/46] block: Avoid error accumulation in bdrv_img_create() |
Date: |
Wed, 24 Jun 2020 18:43:18 +0200 |
When creating an image fails because the format doesn't support option
"backing_file" or "backing_fmt", bdrv_img_create() first has
qemu_opt_set() put a generic error into @local_err, then puts the real
error into @errp with error_setg(), and then propagates the former to
the latter, which throws away the generic error. A bit complicated,
but works.
Not that qemu_opt_set() returns a useful value, we can simply ignore
the generic error instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
block.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index 93a5fbf60a..2dcf9afd61 100644
--- a/block.c
+++ b/block.c
@@ -6087,7 +6087,7 @@ void bdrv_img_create(const char *filename, const char
*fmt,
if (base_filename) {
if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename,
- &local_err)) {
+ NULL)) {
error_setg(errp, "Backing file not supported for file format '%s'",
fmt);
goto out;
@@ -6095,7 +6095,7 @@ void bdrv_img_create(const char *filename, const char
*fmt,
}
if (base_fmt) {
- if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &local_err)) {
+ if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, NULL)) {
error_setg(errp, "Backing file format not supported for file "
"format '%s'", fmt);
goto out;
--
2.26.2
- [PATCH 30/46] s390x/pci: Fix harmless mistake in zpci's property fid's setter, (continued)
- [PATCH 30/46] s390x/pci: Fix harmless mistake in zpci's property fid's setter, Markus Armbruster, 2020/06/24
- [PATCH 44/46] qemu-img: Ignore Error objects where the return value suffices, Markus Armbruster, 2020/06/24
- [PATCH 24/46] qapi: Smooth error checking manually, Markus Armbruster, 2020/06/24
- [PATCH 37/46] qom: Make functions taking Error ** return bool, not void, Markus Armbruster, 2020/06/24
- [PATCH 20/46] block: Avoid error accumulation in bdrv_img_create(),
Markus Armbruster <=
- [PATCH 32/46] qom: Rename qdev_get_type() to object_get_type(), Markus Armbruster, 2020/06/24
- [PATCH 25/46] qapi: Smooth visitor error checking in generated code, Markus Armbruster, 2020/06/24
- [PATCH 26/46] qapi: Smooth another visitor error checking pattern, Markus Armbruster, 2020/06/24
- [PATCH 18/46] qemu-option: Smooth error checking manually, Markus Armbruster, 2020/06/24