From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [PULL v2 43/53] qemu-img: Ignore Error objects where the return value suffices
Date: Fri, 10 Jul 2020 15:31:02 +0200 [thread overview]
Message-ID: <20200710133103.2153250-4-armbru@redhat.com> (raw)
In-Reply-To: <20200710133103.2153250-1-armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-44-armbru@redhat.com>
[One more in img_amend() due to commit 0bc2a50e17 "qemu-option: Use
returned bool to check for failure"]
---
qemu-img.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 41d2b91091..498fbf42fe 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -465,22 +465,18 @@ static int add_old_style_options(const char *fmt, QemuOpts *opts,
const char *base_filename,
const char *base_fmt)
{
- Error *err = NULL;
-
if (base_filename) {
if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename,
- &err)) {
+ NULL)) {
error_report("Backing file not supported for file format '%s'",
fmt);
- error_free(err);
return -1;
}
}
if (base_fmt) {
- if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &err)) {
+ if (!qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, NULL)) {
error_report("Backing file format not supported for file "
"format '%s'", fmt);
- error_free(err);
return -1;
}
}
@@ -4214,17 +4210,12 @@ static int img_amend(int argc, char **argv)
opts = qemu_opts_create(amend_opts, NULL, 0, &error_abort);
if (!qemu_opts_do_parse(opts, options, NULL, &err)) {
/* Try to parse options using the create options */
- Error *err1 = NULL;
amend_opts = qemu_opts_append(amend_opts, bs->drv->create_opts);
qemu_opts_del(opts);
opts = qemu_opts_create(amend_opts, NULL, 0, &error_abort);
- qemu_opts_do_parse(opts, options, NULL, &err1);
-
- if (!err1) {
+ if (qemu_opts_do_parse(opts, options, NULL, NULL)) {
error_append_hint(&err,
"This option is only supported for image creation\n");
- } else {
- error_free(err1);
}
error_report_err(err);
--
2.26.2
next prev parent reply other threads:[~2020-07-10 13:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-10 13:30 [PULL v2 00/53] Error reporting patches patches for 2020-07-07 Markus Armbruster
2020-07-10 13:31 ` [PULL v2 14/53] qemu-option: Use returned bool to check for failure Markus Armbruster
2020-07-13 13:05 ` Peter Maydell
2020-07-10 13:31 ` [PULL v2 26/53] qom: Put name parameter before value / visitor parameter Markus Armbruster
2020-07-10 13:31 ` Markus Armbruster [this message]
2020-07-10 13:31 ` [PULL v2 50/53] fw_cfg: Use ERRP_GUARD() Markus Armbruster
2020-07-10 14:50 ` [PULL v2 00/53] Error reporting patches patches for 2020-07-07 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200710133103.2153250-4-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).