qemu_chr_new_from_opts() is used from both vl.c and hmp,
and it is quite confusing to see qemu suddenly exit after receiving a help
option in hmp.
Do exit(0) from vl.c instead.
Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com>
Message-Id: <
1500977081-120929-1-git-send-email-anton.nefedov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
error_report("Available chardev backend types: %s", str->str);
g_string_free(str, true);
- exit(0);
+ return NULL;
}
if (id == NULL) {
*
* @opts see qemu-config.c for a list of valid options
*
- * Returns: a new character backend
+ * Returns: on success: a new character backend
+ * otherwise: NULL; @errp specifies the error
+ * or left untouched in case of help option
*/
Chardev *qemu_chr_new_from_opts(QemuOpts *opts,
Error **errp);
{
Error *local_err = NULL;
- qemu_chr_new_from_opts(opts, &local_err);
- if (local_err) {
- error_report_err(local_err);
- return -1;
+ if (!qemu_chr_new_from_opts(opts, &local_err)) {
+ if (local_err) {
+ error_report_err(local_err);
+ return -1;
+ }
+ exit(0);
}
return 0;
}