diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-02-12 17:59:06 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-02-26 14:49:52 +0100 |
commit | d93ae3cfb9ec36ea53d8ff24af812db6dd9bb62a (patch) | |
tree | 40f637977257c264bd896af0f51086268409cfc9 /util | |
parent | f43e47dbf6de24db20ec9b588bb6cc762093dd69 (diff) |
QemuOpts: Propagate errors through opts_do_parse()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'util')
-rw-r--r-- | util/qemu-option.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/util/qemu-option.c b/util/qemu-option.c index 928b86f0b0..8a0f69e37b 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -750,8 +750,8 @@ void qemu_opts_print(QemuOpts *opts, const char *sep) } } -static int opts_do_parse(QemuOpts *opts, const char *params, - const char *firstname, bool prepend) +static void opts_do_parse(QemuOpts *opts, const char *params, + const char *firstname, bool prepend, Error **errp) { char option[128], value[1024]; const char *p,*pe,*pc; @@ -789,21 +789,27 @@ static int opts_do_parse(QemuOpts *opts, const char *params, /* store and parse */ opt_set(opts, option, value, prepend, &local_err); if (local_err) { - qerror_report_err(local_err); - error_free(local_err); - return -1; + error_propagate(errp, local_err); + return; } } if (*p != ',') { break; } } - return 0; } int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname) { - return opts_do_parse(opts, params, firstname, false); + Error *err = NULL; + + opts_do_parse(opts, params, firstname, false, &err); + if (err) { + qerror_report_err(err); + error_free(err); + return -1; + } + return 0; } static QemuOpts *opts_parse(QemuOptsList *list, const char *params, @@ -843,7 +849,10 @@ static QemuOpts *opts_parse(QemuOptsList *list, const char *params, return NULL; } - if (opts_do_parse(opts, params, firstname, defaults) != 0) { + opts_do_parse(opts, params, firstname, defaults, &local_err); + if (local_err) { + qerror_report_err(local_err); + error_free(local_err); qemu_opts_del(opts); return NULL; } |