@@ -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) ||
@@ -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,
@@ -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);
qemu_chr_parse_compat() calls qerror_report_err() because its callers expect QError semantics. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- qemu-char.c | 12 ++++++++++-- qemu-option.c | 10 ++++------ qemu-option.h | 3 ++- 3 files changed, 16 insertions(+), 9 deletions(-)