This eliminates a use of monitor_is_qmp() from the error reporting
path.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
util/error-report.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/util/error-report.c b/util/error-report.c
index bbea49a55d..b0e062da9f 100644
--- a/util/error-report.c
+++ b/util/error-report.c
@@ -223,16 +223,15 @@ char *real_time_iso8601(void)
G_GNUC_PRINTF(2, 0)
static void vreport(report_type type, const char *fmt, va_list ap)
{
- Monitor *cur = monitor_cur();
- gchar *timestr;
-
/*
* When current monitor is QMP, messages must go to stderr
- * and have prefixes added
+ * and have prefixes added, so we cast to HMP, leaving 'cur'
+ * as NULL in QMP case
*/
- if (monitor_cur_is_qmp()) {
- cur = NULL;
- }
+ Monitor *cur = MONITOR(
+ object_dynamic_cast(OBJECT(monitor_cur()), TYPE_MONITOR_HMP));
+ gchar *timestr;
+
if (!cur) {
qemu_flockfile(stderr);
}
--
2.53.0