[PATCH v3 34/49] qemu-print: switch to use monitor_cur_hmp()
Marc-André Lureau <[email protected]>
| Newsgroups | org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Note that this fixes qemu_vprintf() (and thus qemu_printf) to do as said in the code comment: print to current HMP if we have one, else to stdout, instead of trying to print to the current monitor (which may not actually have hmp-only print capability/callback and fail silently). Signed-off-by: Marc-André Lureau <[email protected]> --- util/qemu-print.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/util/qemu-print.c b/util/qemu-print.c index a2d1f0244168..0eecc05b0330 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -21,9 +21,9 @@ */ int qemu_vprintf(const char *fmt, va_list ap) { - Monitor *cur_mon = monitor_cur(); - if (cur_mon) { - return monitor_vprintf(cur_mon, fmt, ap); + MonitorHMP *hmp = monitor_cur_hmp(); + if (hmp) { + return monitor_vprintf(MONITOR(hmp), fmt, ap); } return vprintf(fmt, ap); } @@ -53,7 +53,8 @@ int qemu_printf(const char *fmt, ...) int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) { if (!stream) { - return monitor_vprintf(monitor_cur(), fmt, ap); + MonitorHMP *hmp = monitor_cur_hmp(); + return hmp ? monitor_vprintf(MONITOR(hmp), fmt, ap) : -1; } return vfprintf(stream, fmt, ap); } -- 2.55.0.543.g5ebe2ebe4ea8