qemu_chr_parse_compat() calls qerror_report_err() because its callers expect QError semantics.
Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com> --- qemu-char.c | 12 ++++++++++-- qemu-option.c | 10 ++++------ qemu-option.h | 3 ++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 3a5d2b6..acb0c30 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2651,8 +2651,12 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) qemu_opt_set(opts, "host", host); qemu_opt_set(opts, "port", port); if (p[pos] == ',') { - if (qemu_opts_do_parse(opts, p+pos+1, NULL) != 0) + qemu_opts_do_parse(opts, p+pos+1, NULL, &local_err); + if (error_is_set(&local_err)) { + qerror_report_err(local_err); + error_free(local_err); goto fail; + } } if (strstart(filename, "telnet:", &p)) qemu_opt_set(opts, "telnet", "on"); @@ -2683,8 +2687,12 @@ QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) } if (strstart(filename, "unix:", &p)) { qemu_opt_set(opts, "backend", "socket"); - if (qemu_opts_do_parse(opts, p, "path") != 0) + qemu_opts_do_parse(opts, p, "path", &local_err); + if (error_is_set(&local_err)) { + qerror_report_err(local_err); + error_free(local_err); goto fail; + } return opts; } if (strstart(filename, "/dev/parport", NULL) || diff --git a/qemu-option.c b/qemu-option.c index 41e7a57..8a9d8d5 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -895,18 +895,16 @@ static void opts_do_parse(QemuOpts *opts, const char *params, } } -int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname) +void qemu_opts_do_parse(QemuOpts *opts, const char *params, + const char *firstname, Error **errp) { Error *local_err = NULL; opts_do_parse(opts, params, firstname, false, &local_err); if (error_is_set(&local_err)) { - qerror_report_err(local_err); - error_free(local_err); - return -1; + error_propagate(errp, local_err); + return; } - - return 0; } static QemuOpts *opts_parse(QemuOptsList *list, const char *params, diff --git a/qemu-option.h b/qemu-option.h index e9fbbb5..4480c17 100644 --- a/qemu-option.h +++ b/qemu-option.h @@ -126,7 +126,8 @@ int qemu_opts_set(QemuOptsList *list, const char *id, const char *qemu_opts_id(QemuOpts *opts); void qemu_opts_del(QemuOpts *opts); void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp); -int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname); +void qemu_opts_do_parse(QemuOpts *opts, const char *params, + const char *firstname, Error **errp); QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params, int permit_abbrev); void qemu_opts_set_defaults(QemuOptsList *list, const char *params, int permit_abbrev); -- 1.7.9.2.384.g4a92a